Before updating scaffolding from new db schema
While EF lets you get off the ground and running fast, it’s deployment story (both first time and subsequent upgrades) has been a little sketchy.With the release 4.2 and EF Migrations, the upgrade story has been simplified a little but the first time deployment story still has a couple of points to keep in mind.Let’s say we have a very simple application with a single table that maps to an entity called Blog Post. NET Internet Template that includes the Authentication and Authorization entities.The Default Providers will create the required tables for these as well.If it fails to find the DB, it will give an error as follows - In case of an Error, click on OK to dismiss the dialog and open Web.config file.Update the server name in the ‘Data Source’ to point to the correct SQL Server (below we see the SQL Express instance is called SQLEXPRESSR2 instead of the traditional SQLEXPRESS. Use the ‘Register’ link on the top to register a username.However in prototyping stage, we will be adding/modifying and deleting schema elements.
We all love the speed with which we can get off the ground with our prototypes.
We then pass the connection name to the base DBContext and use the schema name to map our entities to the tables in DB explicitly.