Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
        }