I have a LINQ to SQL object that I will serialize and return as JSON through a webservice call.
There is one property in this object that I would not want to serialize. For this, there usually exists an attribute [ScriptIgnore]that works exactly the way I want, if I manually add it to the file designer.cs.
Now, since the constructor file is automatically created, I would prefer not to manually edit it, since any changes can be easily overwritten. So my question is: is there a way to annotate a property so that it is excluded from serialization directly in the DBML editor?
If the answer is no; Are there any solutions for this that are more accurate than manually setting the property nullbefore serializing it or returning an anonymous type identical except for one property? In MVC.NET, is there a way to pass parameters to a method JSON()to change its behavior, maybe?
My apologies if this was asked before - I would expect this to be a general question, but I could not find anyone like that.
source
share