Take the 2-minute tour ×

So I'm starting to look into using the EF with POCO and transfering DTO over the wire to client of my WCF.

Looks like it's a good architectural design to go with DTO instead of sending POCO over to the client.

So I was reading about it and a lot of time it mentionned using the Adapter pattern to convert the POCO to DTO.

I can't seem to find any article describing the Adapter patter used for POCO => DTO.

Can someone shed a bit of light concerning this?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Adapter is GoW pattern with exact meaning. You don't need special article to read about using it on top of POCO and DTOs (it is same like with any other classes). But I think you actually don't want a real adapter. You want something which will convert POCO to DTO and vice versa. Many developers are using very good library called AutoMapper. I usually don't use neither adapter or AutoMapper. Instead my DTO's have static methods called ToPoco and FromPoco - it is stupid, it is more writting but everybody understand it.

share|improve this answer
I was wondering how to use it with the adapter pattern. Going with this dofactory.com/Patterns/PatternAdapter.aspx i was thinking so the target is the DTO ... so i create an adapter to wrap my poco? ... –  pdiddy Feb 11 '11 at 1:22
add comment

This post talks about the purity of the two.

But as far as converting them from one to the other, I have used extension methods in the past.

So before the POCO is being sent over the wire, I have something like this.


which converts it into a WCF datacontract obj, serialized and sent across the wire.

On the other side I have


Which converts it back into POCO.

It's not the most elegant, but it works.

share|improve this answer
add comment

Your Answer


