i am using generic repository to develop my own BLL with entity framework.Generic Repository But all generic repository doesn't have inner join. Lokk below :
public interface IRepository
{
IQueryable<T> List<T>() where T : class;
T Get<T>(int id) where T : class;
void Create<T>(T entityTOCreate) where T : class;
void Edit<T>(T entityToEdit) where T : class;
void Delete<T>(T entityToDelete) where T : class;
}
How to convert above code to :
public interface IRepository
{
IQueryable<T> List<T>() where T : class;
T Get<T>(int id) where T : class;
void Create<T>(T entityTOCreate) where T : class;
void Edit<T>(T entityToEdit) where T : class;
void Delete<T>(T entityToDelete) where T : class;
void InnerJoin<T>(T entityName, TNew entityName2) where T : class, where TNew : class;
}
or i think that we can use Fluent interfacve pattern like that:
public List<MyWorker> ListByID( int ID)
{
using (var Ctx = new DomainRepository<Worker>(new ProposalsEntities()))
return Ctx.Find<Worker>(q => q.ID== ID).ToList().InnerJoin(XEntity,x=>x.ID=q.ID).InnerJoin(YEntity,y=>y.ID=q.ID);
}
Yuo can give another advise to achive this fantastical question. How can i write above join code in Generic Repository?