namespace ProductsAPI.Migrations
{
using ProductsAPI.Models;
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
internal sealed class Configuration : DbMigrationsConfiguration<ProductsAPI.Models.ProductsAPIContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
}
protected override void Seed(ProductsAPI.Models.ProductsAPIContext context)
{
context.Manufacturers.AddOrUpdate(new Manufacturer[] {
new Manufacturer() { ManufacturerId = 1, Name = "Apple, Samsung" },
new Manufacturer() { ManufacturerId = 2, Name = "Sony, Micromax" },
new Manufacturer() { ManufacturerId = 3, Name = "Toshibha, Videocon" },
new Manufacturer() { ManufacturerId = 4, Name = "Hero, Honda" }
});
context.Products.AddOrUpdate(new Product[] {
new Product() { ProductId = 1, Title= "Macbook", Category = "Electronics",
ReleaseDate = new DateTime(2000, 12, 16), ManufacturerId = 1, Description =
"An Apple Laptop.", Price = 14.95M },
new Product() { ProductId = 1, Title= "Xperia", Category = "Mobiles",
ReleaseDate = new DateTime(2000, 12, 11), ManufacturerId = 2, Description =
"A Sony Mobile.", Price = 14.95M },
new Product() { ProductId = 1, Title= "Grand Flip cover", Category = "Covers",
ReleaseDate = new DateTime(2000, 12, 10), ManufacturerId = 2, Description =
"A Samsung Product.", Price = 14.95M },
new Product() { ProductId = 1, Title= "Canvas", Category = "BudgetMobiles",
ReleaseDate = new DateTime(2000, 10, 11), ManufacturerId = 3, Description =
"A Micromax Mobile.", Price = 14.95M },
new Product() { ProductId = 1, Title= "Toshibha", Category = "Harddisk",
ReleaseDate = new DateTime(2000, 11, 11), ManufacturerId = 4, Description =
"A Toshibha hardisk.", Price = 14.95M },
});
}
}
}
- Step 3 Again in the Package Manager Console window, type the following commands.
s.