0

I want to hand-write my POCO's as simple classes with virtual properties so that the entity framework can generate proxies. I will enable proxy creation (which is on by default) so I can have change tracking and lazy loading.

My question is: can I have them?

More specifically, I noticed that the POCO template generator generates classes with a FixupCollection<T>. Is that necessary to have? If I make the navigational properties in my simple hand-written POCO a virtual IEnumerable<T>, will that suffice without any FixupCollection<T> stuff?

As an alternative, I could use the POCO template generator but I do not wish to, because my model is quite large and complicated. I will need to keep making changes to the model and will need to keep editing the model class definitions. If I use the POCO template generator, every time I need to regenerate the model for some reason, it will overwrite all my custom changes.

So, is it possible to just have POCO's in the real spirit of their name?

Water Cooler v2
  • 32,724
  • 54
  • 166
  • 336

1 Answers1

1

Yes, of corse it is possible. http://msdn.microsoft.com/en-us/library/vstudio/dd456853%28v=vs.100%29.aspx

FixupCollection class can be used by the POCO classes to keep the opposite ends of a relationships in sync.

http://blogs.msdn.com/b/adonet/archive/2010/01/25/walkthrough-poco-template-for-the-entity-framework.aspx

yonexbat
  • 2,902
  • 2
  • 32
  • 43