- They introduced me to something called NuGet which is a way to get a project reference to something that was released after .Net Framework 4.0 was released. You can go to Microsoft's website and download the release, or you can right click on references and select "Add Library Package Release". This brings up a multipage window of many different references you can select. In this case they selected, the EntityFramework 4.1. This downloaded and set up the references automatically.
- Once this package was referenced they were able to add a "Context" class to their project by inheriting from dbContext. This allowed them to create public properties of dbSets (basically lists of custom objects).
- They used MVC and the EntityFramework to generate a database in their local SQL Express database. This was automatically created when they ran the app.
- They then went through how to configure the database fields (i.e. isnullable, max length, etc) by overriding the OnModelCreating method in the Context class (modelbuilder.entity...).
- They also discussed how to use some of that stuff for validation on the View.
- They duscussed something called EntityFrameworkMigrations, which isn't available yet but is supposed to help keep databases and applications synced.
- They also discussed something called Code First Power Tools, which are "almost available". This has a right-click context menu in VS, "Reverse Engineer From Database" which allows you to create classes from an existing database. This could be interesting...
- The next version of EntityFramework will support Enum and Spacial data.
Tuesday, May 17, 2011
Code First Development in ADO.Net Entity Framework 4.1 (aka Magic Unicorn Edition)
The demo that the instructors were doing was in MVC. Some highlights of the session:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment