예제 #1
0
        public SearchTests()
        {
            // Use a clean instance of the context to run the test
            var options = new DbContextOptionsBuilder <EmplyeeDbConext>()
                          .UseInMemoryDatabase(databaseName: $"Clarkson.Empoyees.{Guid.NewGuid().ToString()}")
                          .Options;

            var conext = new EmplyeeDbConext(options);

            _manager = new EmployeeManager(conext);
        }
예제 #2
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new EmplyeeDbConext(
                       serviceProvider.GetRequiredService <DbContextOptions <EmplyeeDbConext> >()))
            {
                // Look for any board games.
                if (context.Employee.Any())
                {
                    return;   // Data was already seeded
                }

                var employees = EmployeeSeed.Data();
                context.Employee.AddRange(employees);

                context.SaveChanges();
            }
        }
예제 #3
0
 public EmployeeManager(EmplyeeDbConext conext)
 {
     _conext = conext;
 }