Is there any way to generate a context initializer from database entries etc?
I am using Code First 4.2 and want to have a consistent set of data to start my application.
I have a large context I want to populate and I don’t want to manually type it out. Also is there anyway to generate random data etc that meets the requirements of the entities?
One thing you could use are the DataGeneration plans that the DatabaseProject has. We use them to generate our test data with some meaningful values.
Here you can find a walktrough.
Or you could use Sql Server Management Studio to script the data that is currently in your database and execute that script in your Initializer.