예제 #1
0
파일: Seeding.cs 프로젝트: Faiqg/lga-web
        private void SeedSEIFA_2011(SeedingContext context)
        {
            string resourceName = @"Repository.SeedData.SEIFA_2011.csv";

            IScoreImportStrategy strategy = new ScoreImportStrategy();
            Stream stream = GetStream(resourceName);

            strategy.SeedToContext(stream, context);
        }
예제 #2
0
        public DataSeederTests()
        {
            var serviceProvider = new ServiceCollection()
                                  .AddEntityFrameworkInMemoryDatabase()
                                  .BuildServiceProvider();

            _options = new DbContextOptionsBuilder <DotIdContext>()
                       .UseInMemoryDatabase(Guid.NewGuid().ToString())
                       .UseInternalServiceProvider(serviceProvider)
                       .Options;
            var context = new DotIdContext(_options);

            var locationSeeder  = new LocationImportStrategy(context);
            var queryRepository = new QueryRepository(Options.Create(new ConnectionStrings()
            {
                SqlServer = "Server=localhost;Database=DotId;User Id=testuser;Password=testuser;"
            }));

            var scoreSeeder = new ScoreImportStrategy(context, queryRepository);

            _dataSeeder = new DataSeeder(locationSeeder, scoreSeeder);
        }