Thursday, August 27, 2009

Passing LINQ to SQL objects over WCF

I came accross a cool artile that explains just that :


I just had to bookmark it.

Its pretty simple. Click the whitespace in your dbml file. Select its properties and set the serialization mode from "None" (the default) to "Unidirectional". Tada... now you can send the objects returned from linq over the wire with complete intellisense and debugging awesomeness of visual studio!

However you cannot serialize DataContext :( There is a workaround though. It involves setting up a timestamp column. So without further ado here it is.

To learn more about serialization I recommend the mike taulty video: Type Serialization

Enjoy!