public static void Initialize(IServiceProvider serviceProvider) { using var context = new HahnDbContext( serviceProvider.GetRequiredService <DbContextOptions <HahnDbContext> >() ); // Look for any department. if (context.Department.Any()) { return; // Data was already seeded } context.Department.AddRange( new Department { ID = DepartmentEnum.HQ, Name = "HQ" }, new Department { ID = DepartmentEnum.MantenanceStation, Name = "Mantenance Station" }, new Department { ID = DepartmentEnum.Store1, Name = "Store 1" }, new Department { ID = DepartmentEnum.Store2, Name = "Store 2" }, new Department { ID = DepartmentEnum.Store3, Name = "Store 3" } ); context.SaveChanges(); }
public DepartmentService(IMapper mapper, HahnDbContext dataContext) { _db = dataContext; _mapper = mapper; }
public Repository(HahnDbContext context) { this.context = context; entities = context.Set <T>(); }
public ApplicantRepository(HahnDbContext context) : base(context) { }
public Repository(HahnDbContext db) { Db = db; DbSet = db.Set <TEntity>(); }
public UnitofWork(HahnDbContext dataEngineDbContext) { this._context = dataEngineDbContext; }
//private IRepository<Book> _bookRepository; public UnitOfWork(HahnDbContext databaseContext) { _databaseContext = databaseContext; }
public UnitOfWork(HahnDbContext db) { _db = db; }
public BaseRepository(HahnDbContext dbContext) { this._context = dbContext; }
public DatabaseInitializer(HahnDbContext dbContext) { this.dbContext = dbContext; }
public GenericRepository(HahnDbContext context) { _context = context; }
public DataRepository(HahnDbContext context) { _context = context; DbSet = context.Set <TEntity>(); }