Entity Framework POCO Template for .NET 3.5

UPON REFLECTION, I DECIDED THAT THIS POST WAS PRETTY MISGUIDED (must have been one of those days...).

So, for safety , I have removed it completely.

You *can* use T4 to customize the code generated for EntityObjects but if you begin with the T4 EntityObject template and replace .NET 4.0 specific logic with old style. FOr example ObjectSet & CreateObjectSet needs to be replaced by ObjectQuery and CreateQuery.

When I have some time, I will update this post to show how to do it.

#1 King Wilder on 3.21.2010 at 1:54 PM

This looks nice and convenient. Question: These generated classes, are they really just C# classes? They aren't associated with the Entity Framework classes or Linq-To-Sql classes, are they?

Any possibility in you making a short "how-to" video on this?

Thanks.

#2 Julie on 3.21.2010 at 2:13 PM

Pure POCO. :) I'll be doing this for one of my upcoming Pluralsight videos.

[http://thedatafarm.com/blog/data-access/two-more-entity-framework-videos-on-pluralsight]

#3 Venkatesh on 4.04.2010 at 10:59 PM

Hi,

I would like to know if we have the Poco feature for VS 2008 also.

#4 Julie on 4.05.2010 at 8:55 AM

The POCO support is new to VS2010 and .NET 4.0.

#5 warmcold on 4.16.2010 at 11:46 PM

I think, the Model1.cs will fail in compiling if target .NET 3.5. The Model1.cs actually uses the ObjectSet(Of TEntity) class, which is only supported by .NET 4.

#6 Julie on 4.18.2010 at 10:06 AM

@warmcold...why did I think I was finding one that was designed for .NET 3.5. Now what I'm seeing is ObjectSets. So step 2 is to modify the T4 to return .NET 3.5 style code. :)

#7 Deepak on 8.18.2010 at 4:26 AM

I was looking for this very badly and can you please post your approach in your blog.

#8 Luke on 9.28.2010 at 9:13 PM

Hi Julie. You say that for safety you have removed the original post. Can you please explain what exactly is unsafe?

#9 Luke on 9.28.2010 at 9:14 PM

By the way, thanks for the videos you've made available. They're helping a lot as I learn my way around entity framework.

#10 julie on 9.29.2010 at 6:49 AM

@luke,

"safety" in that I don't want to misguide anyone. You can get the proper poco template from visualstudiogallery.com. :)

#11 Luke on 9.29.2010 at 9:01 PM

Thanks Julie. I'm stuck with VS2008, .NET 3.5 and EF1 for the project I am currently working on. If I adapt the POCO template from the gallery to .NET 3.5, is there anything I need to watch out for? I can live with the generated POCOs not being totally clean if that's what it will take to maintain relationships. I picked up a copy of your book yesterday and will be spending a lot of today reading so sorry if you've answered these questions elsewhere. Thanks again.