LINQ to SQL : System.Data.Linq.Binary cannot be serialized because it does not have a parameterless constuctor


Don’t be desperate yet. Every problem has a solution 🙂 LINQ to SQL has provided a way to change the data type of every property that is mapped to the actual table column. By default, LINQ uses the original type of the column. As you can see in the LINQ designer surface, the data type of TimeStamp  is automatically set to System.Data.Linq.Binary.

All you have to do is change the data type from System.Data.Linq.Binary to byte[], which doesn’t need to be instantiated during the serialization.

Compile and run the Web Service again. It’s no longer complaining about the serialization issue.

Summary:

in dbml file , Select the column and change its datatype from Binary to Byte[]

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s