public static HLCardGameDbContext CreateDbContext()
        {
            var options = new DbContextOptionsBuilder <HLCardGameDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString("N")).Options;
            var dbContext = new HLCardGameDbContext(options);

            return(dbContext);
        }
        public GenericRepository(
            HLCardGameDbContext dbContext,
            ToEntityDelegate toEntityDelegate,
            ToDomainDelegate toDomainDelegate)
        {
            DbContext = dbContext ??
                        throw new ArgumentNullException(nameof(dbContext));

            _table = DbContext.Set <TEntity>();

            _toEntityDelegate = toEntityDelegate;
            _toDomainDelegate = toDomainDelegate;
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeckRepository"/> class.
 /// </summary>
 /// <param name="dbContext">The database context.</param>
 public DeckRepository(HLCardGameDbContext dbContext)
     : base(dbContext, DeckMapper.ToEntity, DeckMapper.ToModel)
 {
 }