Initializers

Back on page 201, I showed you a snippet for the static (Shared in Visual Basic) Database.SetInitializer() method that told Entity Framework to always re-create the database when the application runs. I’m sure that when you saw it you figured that there were other options, and you were right. In fact, there are three provided by Entity Framework, and you create others if you need to.

Image

Image On Your Own

Here’s an easy one: Write a statement that will tell Entity Framework to only create a physical database if it doesn’t find one already. ...

Get Fluent Entity Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.