XmlMappingSource file format

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Alladin
Posts: 149
Joined: Mon 27 Nov 2006 16:18
Contact:

XmlMappingSource file format

Post by Alladin » Fri 09 Apr 2010 23:03

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?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 13 Apr 2010 11:36

We experience some problems with XML-based mapping.
I will let you know as soon as this problem is fixed.

Alladin
Posts: 149
Joined: Mon 27 Nov 2006 16:18
Contact:

Post by Alladin » Tue 13 Apr 2010 12:10

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.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 15 Apr 2010 12:47

Thank you for sharing your knowledge.
We are working on our XmlMappingSource support improvement.

Post Reply