c# - How to user where in Set<> Method in Entity Framework -
i have unitofwork interface :
public interface iunitofwork { //some other methods idbset<tentity> set<tentity>() tentity : class; } and implement this:
public class storecontext : dbcontext, iunitofwork { public new idbset<tentity> set<tentity>() tentity : class { return base.set<tentity>(); } } and use set methods service layer :
public class brandservice : ibrandservice { private readonly iunitofwork _uow; private readonly idbset<brand> _brands; public brandservice(iunitofwork uow) { _uow = uow; _brands = _uow.set<brand>(); } } i want use in service layer after set method :
_brands = _uow.set<brand>().where(row=>row.isactive == true); but returns error :
cannot implicitly convert type 'system.linq.iqueryable' 'system.data.entity.idbset'
how can ?
i searched on google cant find similar question.
i used code :
_uow = uow; _brands = _uow.set<brand>(); var data = _uow.set<brand>().where(e => e.isdeleted == false); _brands = (idbset<brand>)data.tolist(); but returns buildplan.cs not found
you can't assign iqueryable idbset. change declaration
private iqueryable<brand> _brands;
Comments
Post a Comment