The problem can be that some predefined databases can have aspects that are awkward to deal with from the software side.

error before updating scaffolding from new db schema try creating-74

Pre-existing SQL databases, particularly if complex, can often pose problems for software developers who are creating a new application.

The data may be in a format that makes it hard to access or update, and may include SQL functions and procedures.

Jon Smith looks at what tools there are in Microsoft’s Entity Framework's Data Access technology that can deal with these requirements.

In many large-scale projects, software developers are often have to work with existing SQL Server databases with predefined tables and relationships.

This produces data classes with various Data Annotations to set some of the properties, such as string length and nullablity (see the example below built around the Customer Table), plus a Db Context with an On Model Creating method to set up the various relationships. Certainly it is very useful to have the Data Annotations because front-end systems like MVC use these for data validation during input.

However I did have a couple of problems: As I said earlier the standard templates enable ‘lazy loading’.I have been corrected in my understanding of lazy loading by some readers.I’ll actually use the Adventure Works LT2012 database, which is a cut-down version of the larger Adventure Works OLTP database. NET MVC5 (MVC) with the propriety Kendo UI package for the UI/presentation layer, which I cover in the next article.At the end, I also mention some other techniques that I didn’t need for Adventure Works, but I have needed on other databases.The aim is to show how you can use EF with pre-existing databases, including ones that need direct access to T-SQL commands and/or Stored Procedures.Entity Framework has a well-documented approach, called reverse engineering, to create the EF Entity Classes and from an existing database.