示例#1
0
        public Repository(IDataContextAsync context)
        {
            _context = context;
            // Temporarily for FakeDbContext, Unit Test and Fakes
            DbContext dbContext = context as DbContext;

            if (dbContext != null)
            {
                _dbSet = dbContext.Set <TEntity>();
            }
            else
            {
                IFakeDbContext fakeContext = context as IFakeDbContext;

                if (fakeContext != null)
                {
                    _dbSet = fakeContext.Set <TEntity>();
                }
            }
        }
示例#2
0
 public IQueryable <T> All <T>() where T : class, new()
 {
     return(_context.Set <T>().AsQueryable());
 }