Entity Framework and the XmlIgnoreAttribute
Posted
by Mikey Cee
on Stack Overflow
See other posts from Stack Overflow
or by Mikey Cee
Published on 2010-03-15T02:23:49Z
Indexed on
2010/03/15
2:29 UTC
Read the original article
Hit count: 434
entity-framework
Say you have a one to one relationship in your entity model. The code generator will decorate it with the following attributes:
[global::System.Xml.Serialization.XmlIgnoreAttribute()]
[global::System.Xml.Serialization.SoapIgnoreAttribute()]
public RelatedObject Relationship { get {...} set {...} }
I want to serialize my parent object together with all its properties for which data has been loaded through an XML web service. Obviously, these related properties do not get serialized because of these attributes.
So for my purposes I just want to remove these "don't serialize me" attributes. I can do a find and replace in the designer code, but any modifications I make in the designer will put these attributes back in.
How do I permanently get rid of these attributes?
VS 2008 / EF 3.5.
© Stack Overflow or respective owner