Beispiel #1
0
        public SqlRepository(IntranetDbContext dbContext)
        {
            if (dbContext == null)
            {
                throw new ArgumentNullException(nameof(dbContext));
            }

            _dbContext = dbContext;
            _dbSet     = dbContext.Set <T>();
        }
Beispiel #2
0
        public IList <T> GetMany(IEnumerable <TKey> ids)
        {
            var idList = ids as IList <TKey> ?? ids.ToList();

            if (idList.IsEmpty())
            {
                return(new List <T>());
            }

            var result = _dbContext.Set <T>().Join(
                idList,
                ent => ent.Id,
                id => id,
                (ent, id) => ent);

            return(result.ToList());
        }