Пример #1
0
        /// <summary>
        /// Gets a subset of entity T by a given condition.
        /// </summary>
        /// <param name="predicate"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        public IQueryable <TEntity> GetByCondition(Expression <Func <TEntity, bool> > predicate)
        {
            if (predicate == null)
            {
                throw new ArgumentNullException();
            }

            var result = _context
                         .Set <TEntity>()
                         .Where(predicate);

            return(result);
        }
Пример #2
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="context">Object context</param>
 public Repository(DemographicsDbContext context)
 {
     _context    = context;
     this._dbSet = _context.Set <T>();
 }