tags:

views:

60

answers:

2

How do i automatically serialize classes that are generated by the mapping of LINQ to SQL? I need to use these objects in WCF.

.NET 3.5 SP1.

A: 

Short of using the CodeDOM to generate the classes and compile them, this is impossible. Create DTO's for the transfer. This will make your types strong and whoever is maintaining this code will thank you.

Yuriy Faktorovich
could you explain DTO's please?
Shawn Mclean
DTO stands for Data Transfer Object. It basically means creating simple lightweight classes(no business logic) just to transfer the data.
Yuriy Faktorovich
+1  A: 

On the designer surface, click on the background (i.e. not on any specific entity), and change the "Serialization Mode" to "Unidirectional". That should add the necessary [DataContract] / [DataMember] attributes to the whole model, enabling WCF.

Marc Gravell