BANGALORE, INDIA: Microsoft's ASP.NET MVC3 already added a huge bunch of features to the web development stack in Visual Studio 2010. But barely 3 months after the release of MVC3, had Microsoft released an update – not to the stack itself but for the tools integrated within Visual Studio.
This update actually adds a bunch of features that allow you to quickly start working with data and other benefits within VS2010.
Among some of the changes that we'll talk about is the new feature called Entity Framework Code-First data modeling. In this you can use EF 4.1 to create a code structure of what your data schema should be and EF will automatically create the database file for you.
Create a simply MVC3 Razor based Web application and install the MVC3 update, EF 4.1 and if possible SQL Compact edition. Make sure you have NuGet Package manager installed and then simply install the EntityFramework.SQLCompact package. This will also install all the required dependencies.
Now in the “Models” folder, create a new class file. Create a couple of classes in it with some fields. If you need to have a relationship between them, use the virtual keyword. For example, to create a Music store database with two tables – Genre and Album they would look like this:
Get most out of your technology infrastructure investments with Dell
About CIOL | Media Kit | Site Map | Contact Us | Help | Write to us | Jobs@CyberMedia | Privacy Policy
Copyright © CyberMedia India Online Ltd. All rights reserved. Usage of content from web site is subject to Terms and Conditions.