Using LocalDB in ASP.NET MVC Application with EntityFramework 6


At times we resort to the use of LocalDB, which in definition is a light weight version of the SQL Server Express, which loads itself on demand (i.e., whenever the application tries to read data using SQLConnection or through EntityFramework etc.,).  The db itself can be created by right clicking on the App_Data folder and selecting Add->SQL Server database option from Visual Studio Solution Explorer.  Once created the .mdf file resides in the App_Data folder and can be accessed via the Server Explorer (which acts as the conduit) to perform mundane db operations such as create/alter table, open query window etc.,

When we employ EF as the ORM to access data, it doesnt work as straight forward as it does with SQL Server based backend options.  One common error that you may see is the below error (as given in the screenshot):

Continue reading

1,001 total views, 1 views today