示例#1
0
 public static void LoadChildren <TEntity>(this ChessGamesDbContext context, TEntity entity, string propName)
     where TEntity : class
 {
     context.Entry(entity)
     .Reference(propName)
     .Load();
 }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Chess DB");
            var c = new ChessGamesDbContext();

            if (c.Database.GetPendingMigrations().Any())
            {
                Console.WriteLine("Applying pending migrations...");
                c.Database.Migrate();
            }
        }
示例#3
0
        private static void Startup(string[] args)
        {
            DbStartup.Reporter = Reporter;

            Configuration = ConfigurationExtensions.Configuration(args);

            Log.Logger = new LoggerConfiguration()
                         .ReadFrom
                         .Configuration(Configuration)
                         .CreateLogger();

            var loggerFactory = new SerilogLoggerFactory(Log.Logger);

            _dbContext = DbStartup.InitDbAsync(args, loggerFactory).Result;

            _mapper = AutoMapperFactory.Create();

            var pgnRepository = new PgnRepository(_dbContext, loggerFactory.CreateLogger <PgnRepository>());

            _svc = new PgnImportService(pgnRepository, _mapper, loggerFactory.CreateLogger <PgnImportService>());

            _svc.Status += ShowStatus;
        }
示例#4
0
 public GamesRepository(
     ChessGamesDbContext dbContext
     )
     : base(dbContext)
 {
 }
 public GamesRepository(ChessGamesDbContext chessGamesDbContext)
 {
     _chessGamesDbContext = chessGamesDbContext;
     CacheChildren();
 }