Updating sql database in asp net
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 documentation states that ‘Lazy loading is the process whereby an entity or collection of entities is automatically loaded from the database the first time that a property referring to the entity/entities is accessed’.
The problem with this is it does not make for efficient SQL commands, as individual SQL SELECT commands are raised for each access to virtual relationships, which is not such as good idea for performance.
One warning about using importing scaffolding – Visual Studio threw a nasty error message when I first tried to import using the scaffolding (see stackoverflow entry).
The problem is that you would then have to re-import the database and so lose all your edits, which you or your colleague might have forgotten about by then, and suddenly your whole web application slows down.
By default the reverse engineering of the database uses some internal scaffolding, but you can import the scaffolding and change it.
There is a very clear explanation of how to import the scaffolding using Nu Get, so I’m not going to repeat it.
Its quicker, only two clicks, but its less controllable. This is a generally useful feature so I use this example to show you how to do this in the next section.
The effect is to apply those attributes to the existing properties.
The problem can be that some predefined databases can have aspects that are awkward to deal with from the software side.