Skip to content

Instantly share code, notes, and snippets.

@oclockvn
Created April 10, 2015 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oclockvn/d0e533f8b763ee3a769e to your computer and use it in GitHub Desktop.
Save oclockvn/d0e533f8b763ee3a769e to your computer and use it in GitHub Desktop.
public class EStoreInitialize : DropCreateDatabaseIfModelChanges<ApplicationDbContext>
{
protected override void Seed(ApplicationDbContext context)
{
var items = new List<Item>
{
new Item {Name="Mouse",Price=50},
new Item {Name="Keyboard", Price=100},
new Item {Name="Fan",Price=200}
};
items.ForEach(i => context.Items.Add(i));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment