Adding a note to highlight Damien’s comment below. Damien is on the EF team and does not recommend using the current Feature CTP with the RC. A new version will be available "soon".
In comments of another blog post Ivan reminds me of something else I ran into the the VS2010 RC.
I tweeted on Tuesday that the Self-Tracking Entities template is now “in the box”.
I also blogged on Tuesday about a change to a file, EF.Utility.CS.ttinclude (or EF.Utility.VB.ttinclude) which the EF T4 Templates depends. The RC version is different from the Beta 2 version.. Using the Beta 2 EF POCO Template with VS2010 RC
The EF Feature CTP contains Code Only functionality and an earlier version of the STE template. Like the POCO template, that STE template depends on the Beta 2 version of the ttinclude file. But the STE template in the VS2010 RC depends on the newer version of the ttinclude file.
If you install the EF Feature CTP on top of the VS2010 RC, you will overwrite the Self Tracking Entities template with the old version and it will no longer work.
I tried to outsmart the process by saving the Item Template zip files, installing the CTP and then copy the RC zip files over the ones which the CTP installed. That didn’t work out very well.
However, doing a repair on VS2010 RC after installing the Feature CTP (and in my case totally mucking things up trying to be clever with the zip files) let me have my cake (Code Only support that works with the VS2010 RC -yay) with the icing (the RC version of teh Self-Tracking Entities which got reinstalled during the repair).
Another alternative is to run the STE template item before installing the CTP. The STE template item creates two template files, one for the context and the other for the entities. Only the entities template is impacted by the Feature CTP installation. Copy the contents of the entities template file somewhere. Then after installing the CTP, you’ll initially create the Beta 2 version of the entities template file, just copy the code from the new file into the template file that’s created.
If you don’t need to use Code Only, don’t install the Feature CTP! 🙂 Originally, the Feature CTP was a source for Code Only support, STEs and the POCO template. The POCO template is now an extension (although see the above link for some current incompatibility issues with the RC) and STEs are now in the box.
Eventually these conflicts will all get sorted out.
Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!
4 thoughts on “Beware Self-Tracking Entities Conflict with Entity Framework CTP & VS2010 RC”
… starting to wish I left on B2… it was working!
Thanks for this post!
We’ve been using EF Feature CTP and VS2010 since August and had problems with our STE templates when VS2010 Beta 2 was released, before the CTP 2 was released. You remember our "frankenbuild" of the CTP, don’t you!
I’m glad you’ve discovered this for us so that we don’t have to trigger this mine with the RC.
One thing worth thinking of with Option 2 above is that the generated template files are still dependent upon the ttinclude file. So even if you save the contents of file before you install the CTP, it will still include the "wrong" version of the include file. I’m not saying it’ll break because I haven’t tried it but it has a risk of breaking or not work as designed.
@Frankenbuild Fredrik. 🙂
re the include file, if you follow the link to the post about the Beta 2 POCo template, it shows how to use the previous include file in the RC.
I wouldn’t recommend using CodeFirst from the Feature CTP2 with VS2010 RC. There will be a CTP3 release very soon.