public IQueryable <T> AsQueryable()
 {
     try
     {
         return(_context.Set <T>().AsQueryable());
     }
     catch
     {
         CreateTablesOnException();
         return(_context.Set <T>().AsQueryable());
     }
 }
示例#2
0
        public override IRepository <T> GetRepository <T>()
        {
            _dbContext.Set <T>();
            var sqlServerRepository = new FlagAsDeletedDecorator <T>(MemoryCache,
                                                                     new FillDefaultValueDecorator <T>(MemoryCache,
                                                                                                       new CacheDecorator <T>(MemoryCache, false,
                                                                                                                              new SqlServerRepository <T>(LoggerFactory, _dbContext)), _loggedInUserProvider));

            if (LogTime)
            {
                var timeLoggedMongoRepository =
                    new LogTimeDecorator <T>(MemoryCache, sqlServerRepository, _logger);
                Repositories.TryAdd(typeof(T), timeLoggedMongoRepository);
            }
            else
            {
                Repositories.TryAdd(typeof(T), sqlServerRepository);
            }
            return(sqlServerRepository);
        }