更新时间:2023-10-16 18:28:40
的XmlSerializer
可能不精彩与关联。如果启用序列化的数据上下文的表面,它增加(WCF)数据契约属性。也许只需使用:
XmlSerializer
may not be wonderful with associations. If you enable serialization on the data-context surface, it adds (WCF) data-contract attributes. Perhaps just use:
var data = db.MyEntitys.ToList();
var ser = new DataContractSerializer(data.GetType());
ser.WriteObject(dest, data);