Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
All-Star
118619 Points
18779 Posts
May 04, 2012 02:15 AM|LINK
Hello ryasn:)
EF (Code-First)won't create db or related DataTables until you begin to use it——I mean you should:
1)just do inserting data contents into the entity models,such as:
using (EFContextInstance efi = new EFContextInstance()) { efi.EntityModel.Add(your instance); }
2)Just make a new class that inherit from DropDownDataBaseIfModelChanges class,and override Seed function to do something initailization(Sample from:http://thedatafarm.com/blog/data-access/seeding-a-database-with-ef4-code-first/)。
Reguards!
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: MVC 3 Code First EF not regenerating my database from the model
May 04, 2012 02:15 AM|LINK
Hello ryasn:)
EF (Code-First)won't create db or related DataTables until you begin to use it——I mean you should:
1)just do inserting data contents into the entity models,such as:
using (EFContextInstance efi = new EFContextInstance()) { efi.EntityModel.Add(your instance); }2)Just make a new class that inherit from DropDownDataBaseIfModelChanges class,and override Seed function to do something initailization(Sample from:http://thedatafarm.com/blog/data-access/seeding-a-database-with-ef4-code-first/)。
Reguards!