private async Task <LimpingTest> AddDefaultDataForAnalysis(LimpingDbContext context) { var analysis = new TestAnalysis { Id = Guid.NewGuid(), Description = "Something", EndValue = 1.5, LimpingSeverity = LimpingSeverityEnum.Medium, }; var appUser = context.AppUsers.Add(new AppUser { Id = "1", UserName = "******", LimpingTests = new List <LimpingTest>(), Email = "f", }).Entity; var limpingTest = context.LimpingTests.Add(new LimpingTest { AppUserId = appUser.Id, Date = DateTime.Now, TestAnalysis = analysis, TestData = "{numbers: [1, 2, 3]}" }).Entity; await context.LimpingTests.AddAsync(limpingTest); await context.SaveChangesAsync(); context.Entry(limpingTest).State = EntityState.Detached; context.Entry(appUser).State = EntityState.Detached; context.Entry(analysis).State = EntityState.Detached; return(limpingTest); }
private async Task AddDefaultDataForLimping(LimpingDbContext context) { context.AppUsers.Add(new AppUser { Id = "1", UserName = "******", LimpingTests = new List <LimpingTest>(), Email = "f", }); await context.SaveChangesAsync(); }
public DataMigrationService(LimpingDbContext context, IServiceProvider serviceProvider) { _context = context; // These must be considered immutable, ie. if you want to delete seed data, please add a new one at the end. // We could have dates in names similar to EF migrations, but I think it would require more displine than this does. AllMigrations = new[] { typeof(AddDefaultUser), } .Select(type => serviceProvider.GetRequiredService(type) as BaseDataMigration) .ToList(); }
public DatabaseFixture(LimpingDbContext context, DataMigrationService dataMigrationService) { _dataMigrationService = dataMigrationService; Context = context; var database = context.Database; _manageDatabase = true; if (_manageDatabase) { database.EnsureDeleted(); } database.EnsureCreated(); }
public LimpingTestsService(LimpingDbContext context) { _context = context; }
public DatabaseStartup(LimpingDbContext context, IOptions <LimpingConfiguration> configuration, DataMigrationService seedDataService) { _context = context; _configuration = configuration; _seedDataService = seedDataService; }
public AddDefaultUser(LimpingDbContext context) { _context = context; }
public LimpingTestsController(LimpingDbContext context, ILimpingTestsService limpingTestsService) { _context = context; _limpingTestsService = limpingTestsService; }
public UsersController(LimpingDbContext context, IAppUsersService appUsersService) { _context = context; _appUsersService = appUsersService; }
public AnalysisController(LimpingDbContext context, ITestAnalysesService testAnalysesService) { _context = context; _testAnalysesService = testAnalysesService; }
public AppUsersService(LimpingDbContext context) { _context = context; }
public TestAnalysesService(LimpingDbContext context) { _context = context; }