Looking at EF4 CTP5 in Parts: Part 1 – A New T4 Template

The Entity Framework 4 CTP5 was just released. There are lots of new features that affect the core use of Entity Framework as well as Code First.

I’ll run through some of these features one blog post at a time. The first is the new T4 Template that gets installed, the ADO.NET DbContext Generator.


T4Template

This creates a more lightweight context that inherits from DbContext. DbContext was introduced in CTP4 and exposes a simpler way of working with most commonly used features of ObjectContext.

generatedcontext

 

The POCO classes that are generated are much simpler also. Here’s one of the classes. Notice that, unlike the POCO templates we’ve had for a while, these don’t bother with adding in extra logic for two way navigation (the FixupCollection) for the navigation properties.

simpleclasses

Since we don’t need the FixupCollection, the additional file that the POCO template created to define the FixupCollection is still there but it is now empty.

nosupportingcodenecessary

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

2 thoughts on “Looking at EF4 CTP5 in Parts: Part 1 – A New T4 Template

    1. Thanks Peter. I continue to have major redirect problems hither and thither so I’m gad you pointed this out. I have fixed it. Now waiting for the cache to update.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.