public static void LoadChildren <TEntity>(this ChessGamesDbContext context, TEntity entity, string propName) where TEntity : class { context.Entry(entity) .Reference(propName) .Load(); }
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(); } }
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; }
public GamesRepository( ChessGamesDbContext dbContext ) : base(dbContext) { }
public GamesRepository(ChessGamesDbContext chessGamesDbContext) { _chessGamesDbContext = chessGamesDbContext; CacheChildren(); }