I`m using Entity Framwork and i have the next projection:
var items = from mapsDsc in DbContext.MapsDesc
join mapCat in DbContext.MapsCategories on mapsDsc.MapID equals mapCat.MapID
join mainCat in DbContext.MainCategories on mapCat.MainCategory equals mainCat.MainCatID
join subCat in DbContext.SubCategories on mapCat.SubCategory equals subCat.SubCatID
select new DataModel.ComplexEntities.MapsDescExt
{
MapID = mapsDsc.MapID,
MapName = mapsDsc.MapName,
MapLink = mapsDsc.MapLink,
Note = mapsDsc.Note,
MainCategoryID = mapCat.MainCategory,
MainCategoryName = mainCat.Category,
SubCategoryID = mapCat.SubCategory,
SubCategoryName = subCat.Category
};
Please notice that this projection filling strong type and not anonymous one. I need to customize this projection a little bit but i don`t know how.
At my last join i need to implement the next condition with "or" operator:
join subCat in DbContext.SubCategories on mapCat.SubCategory equals subCat.SubCatID or subCat.SubCatID equals "0"
How can I do it? All the exampels I seen relate to anonymous types and it`s not good for me. Thanks