views:

77

answers:

1

When using wcf and entity framework 4 is it necessary to use POCO? If not how to combine DataContracts with generated classes(i figure one solution is to recreate the domain classes as business classes)?Or what is the best way co combine wcf 4 and ef 4?

A: 

You can either create DTOs and then map to and from your EF objects or you can expose your Entities directly. I'd suggest if you're going to expose your EF Entities over WCF then take a look at Self Tracking Entities which were designed with WCF in mind, the T4 templates already annotate the Entities with the DataContract attribute.

willbt