Controlling the database

Image

In the next chapter we’ll look at two methods for controlling the database schema that Entity Framework creates based on your class structure, but one of the most basic conventions (and one you’ll almost certainly want to use) is how, when and where the database is created. Let’s start by changing the name of the database. After all, CodeFirstDataAccess.RecipeContext is almost certainly not what you want!

You can control the name of the database by adding a connection string in the application’s configuration file (we’ll look at that in a minute), but if all you need to do is change the name of the database, the easiest ...

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.