Using the Beta 2 EF POCO Template with VS2010 RC

Update: After realizing that we still want access to it, the team has made the Beta 2 file available again. You can get it from their original blog post, not from the Visual Studio Gallery links but look for a zip file at the bottom of the post.

But there’s more! While I had managed to figure out one big difference (TemplateFileManager name changed) between the old include file and the new include file it wasn’t enough. which is why after a few hours I gave up and went back to the old include file. But Nikola Malovic figured out the second piece which was how to replace the WriteFiles method which is no longer there! Check out his blog post for the super secret trick!

————————————————–

Entity Framework’s T4 templates all have a dependency on a file that includes additional specialized methods.

If you look at the top of the templates (ENtityObject, POCO or Self-Tracking Entiteis) there is a pointer to a ttinclude file.

<#@ include file="EF.Utility.CS.ttinclude"#>

That file, however, changed after Beta 2. The new templates (EntityObject and STE’s both included in VS2010) work wtih the new version of this file. But the POCO template that was released in December doesn’t.

However, I have a trick to have your cake and eat it too until the new POCO template comes along.

This is just a temporary workaround until a new set of templates hits the airwaves. 🙂

The ttinclude files live here:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes

The new one has a file date of Jan 6, 1010.

You can grab the ttinclude file from Beta 2 and rename it. I’ve renamed mind:

EF.B2.Utility.CS.ttinclude

The file date on that one is Sept 15, 2009.

Then copy it into the Includes folder with the new includes.

Now when you create a new POCO template, you’ll first get error message about TemplateFileManager not existing. In the new include, that’s been renamed to EntityFrameworkTemplateFIleManager. But that’s not hte only change. Fixing that name in your template will not help.

Instead,  just change the reference in the template file to read the Beta 2 include :

<#@ include file="EF.B2.Utility.CS.ttinclude"#>

Then the POCO template will use the Beta 2 version of the include and you can go on your merry way.

Thanks to Dane Morgridge for sending me the VSIX file from the Beta 2 POCO since I had installed directly rather than downloading it to my computer.

9 thoughts on “Using the Beta 2 EF POCO Template with VS2010 RC

  1. If you still have the B2 image, you’ll find the file at

    \WCU\EFTools\ADONETEntityFrameworkTools_enu.cab

    Extract the file named

    EntityDesignerTemplates_EFIncludeCS_x86.3643236F_FC70_11D3_A536_0090278A1BB8

  2. Thanks Julie. That worked great. Any word on when the new POCO templates and other materials from the CTPs will be released for the VS 2010 Release Candidate?

    By the way, its interesting to see all of things you and Danny on the EF team mentioned where in the works a couple of years ago at DevConnection in your EF Workshop when it was just coming out in version 1, are coming to fruition with EF 4. Looking forward to your updated/2nd edition book.

  3. The RC has new STE templates that seem to have fixed some bugs based off the CTP. If you installed the CTP after the RC, you have wiped them out. I found that out the hard way. But I was able to get them back from my coworkers installation. FYI.

Leave a Reply

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