Adapter.
Hello,
does EntityBase and EntityCollectionBase share a common parent or implement an interface for the WriteXml and ReadWml function?
Thanks,
-->because, I am having a generic function that can manipulate either Entity or EntityCollection and that use the Read and WriteXml and I don't want to do a cast:
private static void SaveSingleProfile<T>(string username, T item)//, string fileName)
{
CreateProfileDirectory();
using (StreamWriter writer = new StreamWriter(Settings.Default.UserParam_Common_ProfilePath + username + typeof(T).ToString()))
{
string xml = string.Empty;
if (item is IEntity2)
((IEntity2)item).WriteXml(XmlFormatAspect.Compact, out xml);
if (item is IEntityCollection2)
((IEntityCollection2)item).WriteXml(XmlFormatAspect.Compact, out xml);
writer.Write(xml);
writer.Close();
}
}