Using silverlight 4, with RIA Services Toolkit May 2010.
I have an Entity Data Model (.edmx) which contains a FK reference.
In my DomainContext Service class (which references my .edmx) I modified my GET method to include Include("FK_ENTITY_TABLE_NAME"):
public IQueryable<PARENT_ENTITY> GetPARENT_ENTITY()
{
this.ObjectContext.PARENT_ENTITY.Include("FK_ENTITY_TABLE_NAME");
}
In my DomainContext Service Metadata class (.metadata.cs) named "internal sealed class PARENT_ENTITYMetadata" I added the [Include] attribute to the property which references my FK entity:
[Include]
public FK_ENTITY_TABLE_NAME { get; set; }
My generated (.g.cs) ria service proxy file contains the following DataContract with XmlIgnore:
private EntityRef<FK_ENTITY_TABLE_NAME_PARENT_ENTITY> _fk_entity_table_name;
public sealed partial class PARENT_ENTITY : Entity
{
...
[Association("FK_ENTITY_TABLE_NAME_PARENT_ENTITY", "entity_id", ",entity_id", IsForeignKey=true)]
[XmlIgnore()]
public FK_ENTITY_TABLE_NAME FK_ENTITY_TABLE_NAME
{
...
Therefore, when I use the XmlSerializer / DataContractSerializer and on my PARENT_ENTITY, it skips right over serializing my "FK_ENTITY_TABLE_NAME entity:
<PARENT_ENTITY>
(note: no FK_ENTITY_TABLE_NAME serialized here)
</PARENT_ENTITY>
Is there anything i can do to control the XmlIgnore attribute from being inserted in these generated files?