Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > User defined Serialization for LINQ to SQL generated classes

Reply
Thread Tools

User defined Serialization for LINQ to SQL generated classes

 
 
Benjamin Kalytta
Guest
Posts: n/a
 
      11-11-2007
Hello there,

is there a way to override predefined Serializer for LINQ to SQL class objects?

MSLinqToSQLGenerator generates classes for accessing Database.

I want to create a Webservice which should be able to do certain Operation on
Database and should serialize certain objects. Serializer will try to serialize
all object Properties/fields. I need to prevent certain fields to be included in
serialization because of exceptions caused by cyclic depencies within.

Example:

There is a Table "Customers" in Database. LINQ To SQL Generator will generate
class "Customer" like


[Table(Name="dbo.Customers")]
public partial class Customer :
INotifyPropertyChanging,
INotifyPropertyChanged {

....
public int SomeFieldToExclude;
....

Say there is a field "SomeFieldToExclude" that should not be included in any
Serialization (especially for SOAP Webservices). How can I prevent Serialization
of this Field?

Also note, since this class is automatically generated you can (should) not
modify anything in this file however you can create a new file and extend the
same class since it is a partial class.

Is there any way?

Benjamin Kalytta
 
Reply With Quote
 
 
 
 
learn
Guest
Posts: n/a
 
      12-21-2007
Problem resolved. Please check the solution here (http://
http://www.codeproject.com/KB/dotnet...alization.aspx)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linq or not Linq George ASP .Net 4 11-05-2008 04:53 PM
LINQ to SQL and new MS SQL 2008 datatypes Mike Gleason jr Couturier ASP .Net 1 10-29-2008 03:42 AM
Linq-to-SQL random user errors. Hypercoder ASP .Net 0 08-11-2008 09:07 PM
#if (defined(__STDC__) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) Oodini C Programming 1 09-27-2005 07:58 PM
Serialization Problems and books on serialization? sinleeh@hotmail.com Java 8 01-02-2005 02:40 PM



Advertisments