Page 1 of 1

XmlMappingSource file format

Posted: Fri 09 Apr 2010 23:03
by Alladin
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?

Posted: Tue 13 Apr 2010 11:36
by AndreyR
We experience some problems with XML-based mapping.
I will let you know as soon as this problem is fixed.

Posted: Tue 13 Apr 2010 12:10
by Alladin
I've finally managed to filter attributes that XmlMappingSource doesn't like:

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());
Now I can use XML-based mapping and don't overload my classes with mapping attributes.

Posted: Thu 15 Apr 2010 12:47
by AndreyR
Thank you for sharing your knowledge.
We are working on our XmlMappingSource support improvement.