Domanda

I've seen the question, "what does POCO mean?" asked all over the net, and seen plenty of explanations, but it's still not clear to me. I know it stands for "Plain Old CLR Object", but this isn't really helping me to understand.

Can someone please give me a few examples of something that is NOT a POCO and explain why it is NOT a POCO?

Thanks.

edit: I'm beginning to come to the conclusion that a POCO object is any object that can be easily converted to an identical object in any other CLR-supported language because it does not rely on any platform-specific or language specific library that is not universally available.

È stato utile?

Soluzione 2

Mostly the term is used in situations where a framework provides you with some services (like persistence in case of an ORM) wihout you having to change anything on your business objects. Other frameworks might demand from you that your objects be derived from some base class, or implement some interface. In case of a POCO, it just your plain object, no changes needed.

Altri suggerimenti

POCO just means: nothing but a pure class. No inheritance from any base class (other than eventually your own), no decoration with any attributes, no interface implementation of any kind (other than eventually your own), nothing else that would tie the code in any way to a certain technology.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top