Coffeehouse Post

Single Post Permalink

View Thread: Can I have simple POCO without the FixupCollection stuff?
  • User profile image
    Sathyaish Chakravarthy

    This question pertains to ADO.NET Entity Framework version 4. I recall that we could have simple hand-written POCO's in ADO.NET Entity Framework version 2. I assume that things have remained the same. I want to still confirm because I see that the template generator for POCO's generates an additional fix up code.

    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?