views:

39

answers:

2

Just wondering if the use of POCO's is associated with a particular design pattern.

A: 

POCOs are usually mentioned in the context of persistence ignorance. It can be used to implement the Unit Of Work pattern.

Mark Cidade
Thanks Mark - I need to read the article properly, but at first glance it certainly looks like the 'right' answer.
Adrian K
+1  A: 

I think that POCOs and POJOs are examples of the Single Responsibility Principle (principles are something like design patterns but more general). Say Person POCO can have one reponsibility: storing person data, but for example, if we add persistence to POCO, it won't be POCO any more, and will have 2 responsibilities: storing person data and persisting it.

iirekm
@iirekm - I agree a POxO needs to "embody" (?) SRP, and that adding persistence to it would void that. Beyond SRP, I was thinking there'd be some formal rules (in for form of a pattern) which made that sort of thing clear.
Adrian K