locked
How To add Include to Generic Repository ? RRS feed

  • Question

  • User-1846805900 posted

    Hi

    please i have 2 generic Method in my repository :

            public TEntity Get(int id)
            {
                return Context.Set<TEntity>().Find(id);
            }
    
            public TEntity SingleOrDefault(Expression<Func<TEntity, bool>> predicate)
            {
                return Context.Set<TEntity>().AsNoTracking().SingleOrDefault(predicate);
            }

    and use them as:

    var xx = _unitOfWork.Branch.Get(5);

    no i need to allow both accept include entity to let me add other related property - so please how can i do that ?

    Monday, May 8, 2017 4:16 AM

All replies