c# - Entity framework excluding list of objects -
i have object , should exclude values before showing search result.
iqueryable<tbperson> dataset =context.tbperson; if (!includeirrelevant) { dataset = dataset.where(p => p.tbinfo.relevant); //here have result including column relevant 'true' } else if(enumvalue =! 3)//if not 3 exclude search result { list<tbperson> sellerlist = dataset.where(p=>p.enumcolumn == 3); //here records has enum type 3 var ids = sellerlist.select(x => x.id).toarray(); dataset = dataset.where(x => !ids.contains(x.id)); //trying this, dont know if works, come result //it works!! other elegant solutions expected! }
i tried not figure out exact query exclude 'sellerlist' 'dataset' has search results. want dataset-sellerlist. in advance.
else if(enumvalue =! 3)//if not 3 exclude search result { dataset = dataset.where(x => x.enumcolumn != 3); }
Comments
Post a Comment