mardi 23 octobre 2018

Join in repository pattern confusion

Im using a generic repository which has a following Get mthod:

 public virtual IEnumerable<TEntity> Get(
        Expression<Func<TEntity, bool>> filter = null,
        Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
        string includeProperties = "")
    {

I want to have a join and then apply my filter,here are my classes :

 public class A
{
    [Key]
    public string stID { get; set; }
    public System.DateTime  m_date { get; set; }
    public Boolean presentAbsent { get; set; }
}

 public class B
{
    [Key]
    public string courseID { get; set; }
    public System.DateTime  m_date { get; set; }
    public string  stID { get; set; }
}

here is my filter:

 Expression<Func<A, bool>> whereClause = t => t.presentAbsent == false && t.m_date>=dt1;

now i dont know how should join these two through lambda and apply the filter,join should be on stID:

Repository<A> repo1= new Repository<A>(cr);
Repository<B> repo2= new Repository<B>(cr);

Aucun commentaire:

Enregistrer un commentaire