I have an entity which is auto generated by Entity Framework
from database
public partial class Demand : Entity
{
public string Description { get; set; }
public virtual ICollection<DemandUserComment> DemandUserComments { get; set; }
}
then added A MetadataType
to add DataContract
and DataMemeber
attributes to that Entity (independent of Db changes).
[DataContract(IsReference=true)]
internal class DemandMetaData
{
[IgnoreDataMember]
public virtual ICollection<DemandUserComment> DemandUserComments { get; set; }
}
[MetadataType(typeof (DemandMetaData))]
public partial class Demand
{
}
but the [IgnoreDataMember]
doesn't apply to Demand
how can I handle it?
Use
[NotMapped]
attribute. See the NotMappedAttribute Class on MSDN.