c# - How should I extend a generic repository -
trying understand if can extend generic repository interface or not.
sorry, i'm new , have google search , can't find such implementation leads me think i'm trying defy generic repository logic.
i'm using ef core orm.
i have irepository<t>
:
ienumerable<t> getall(); t get(long id); void insert(t entity); void update(t entity); void delete(t entity);
i implement generic repository:
public class repository<t> : irepository<t> t : class
however need implement special method 1 entity name conference
such as:
ilist<t> getincludeditems(expression<func<t, bool>> predicate, params string[] navigationproperties);
how can extend generic repository handle 1 exception method without having other entities implementing it. in addition, service class
implementing these repositories
via constructor injection.
public conferenceservice(irepository<conference> _conferencerepository )
i need maintain dependency binding via configurservices
.
services.addscoped<iconferenceservice, conferenceservice>();
any suggestion i'm going wrong or how can accomplish this?
here solution problem, need inherit base repository if want add custom method specific entity. click here see how solve above problem
Comments
Post a Comment