O'Reilly logo

Fluent Entity Framework by Rebecca M. Riordan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating initializers

The database initializers provided by the .NET Framework have the basics covered, but there are often good reasons to create your own. You might want the decision to create a new database to be more sophisticated, or based on user input. You might want to check alternate loctaions before making the decision. Or you might want to leverage the Seed() method provided by the existing concrete classes to add some core data to the dictionary when it’s created. Here’s how:

Image

Add the initializer class to your project

You’ll typically add the class to the data access layer. If you’re not going to be seeding data, you can implement ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required