public void Write_Ingredient() { var ndh = new NutrientDataHandler(dbContext); var nutrients = ndh.LoadNutrients(); var units = ndh.LoadUnits(); var branFlakes = CreateIngredient("BF1", "Bran Flakes T1" , nutrients, units); ndh.SaveIngredient(branFlakes); var loaded = ndh.GetIngredient(branFlakes.Id); dbContext.Database.RollbackTransaction(); }
static void Main(string[] args) { var dbContext = new NutritionDbContext(); dbContext.Database.EnsureCreated(); dbContext.Database.Migrate(); new CustomSqlDbContext().Database.Migrate(); var ndh = new NutrientDataHandler(dbContext); var nutrients = ndh.LoadNutrients(); var units = ndh.LoadUnits(); dbContext.Dispose(); }