Hi there,
Where can I find documentation about xml-based mapping?
I've tried to feed *.lqml file to XmlMappingSource.FromReader, but operation fails with FilePerClass exception.
Any help?
XmlMappingSource file format
I've finally managed to filter attributes that XmlMappingSource doesn't like:
LQML file has to be set as Embedded Resource
Now I can use XML-based mapping and don't overload my classes with mapping attributes.
LQML file has to be set as Embedded Resource
Code: Select all
var model = XElement.Load(typeof(MyDataModel).Assembly.GetManifestResourceStream("DevartProbe.MyDataModel.lqml"));
var fpc = model.Attribute("FilePerClass");
if (fpc != null)
fpc.Remove();
var attrs = from type in model.Descendants(XName.Get("Type", "http://schemas.microsoft.com/linqtosql/dbml/2007"))
let attr = type.Attribute("Modifier")
where attr != null
select attr;
foreach (var attr in attrs)
attr.Remove();
mappingSource = XmlMappingSource.FromXml(model.ToString());