tags:

views:

27

answers:

0

I'm trying to create a simple RESTful interface to my data. I've created a WCF web service and decided to use LINQ to SQL to connect to the database. Instead of making simple pass through objects, I decided to try just serializing the objects created by my LINQ to SQL dbml. I changed the Serialization Mode of the dbml to Unidirectional to create the DataContract and DataMember attributes on the generated classes and it all runs. I can even call my GET through my browser and get the XML.

The problem I am having is that when I try to add the service reference from a client application, each class that was given the DataContract attribute gets created twice in the client application when referenced.

For example, I have a class Unit which once the service is referenced in the client application gets mapped to two classes, Unit and Unit1.

What am I doing wrong? Should I not try to serialize these LINQ to SQL generated classes? Should I make specific objects that get filled from the LINQ to SQL classes to serialize and pass around?

Any info is appreciated, thank you.