Hello,
I'm looking for more information on iqml files. Currently when I try to create a new instance of a Devart.Data.Linq.DataContext object (ctor=DataContext(string connectionString, MappingSource mapping)), I get an exception. Unfortunately that exception doesn't contain any useful (to me) information about the problem. I'm guessing the problem is with my MappingSource, but I don't know what specifically is wrong with it.
The Exception that I get is:
System.ArgumentException was unhandled by user code
Message=An item with the same key has already been added.
Source=mscorlib
StackTrace:
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Devart.Data.Linq.Mapping.MetaTypeBase.Initialize()
at Devart.Data.Linq.Mapping.aw.b()
at Devart.Data.Linq.Mapping.u.b()
at Devart.Data.Linq.Mapping.ay..ctor(MetaModel A_0, MetaTable A_1, ae A_2, Type A_3, MetaType A_4)
at Devart.Data.Linq.Mapping.u..ctor(av A_0, ak A_1, ae A_2, Type A_3)
at Devart.Data.Linq.Mapping.ak..ctor(av A_0, d A_1, Type A_2)
at Devart.Data.Linq.Mapping.av.b()
at Devart.Data.Linq.Mapping.av.e()
at Devart.Data.Linq.Mapping.av..ctor(MappingSource A_0, Type A_1, t A_2)
at Devart.Data.Linq.Mapping.XmlMappingSource.CreateModel(Type dataContextType)
at System.Data.Linq.Mapping.MappingSource.GetModel(Type dataContextType)
at Devart.Data.Linq.DataContext.a(Object A_0, MappingSource A_1, Type A_2)
at Devart.Data.Linq.DataContext..ctor(String connectionString, MappingSource mapping)
Is there any documentation on the requirements of an iqml file? In my case I am trying to convert an existing xml file generated by sqlmetal from a SQL Server database, so I think I must just be missing some value(s) that you require but LinqToSql and Sql Server do not.
Thank you,
Patrick
DataContext ctor / iqml question
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
This issue may occur, e.g., if a table description in the mapping file has two Column nodes with the same 'Name' property.
Generally, the proper way of preparing the XML mapping file is to set the "Mapping Mode" model property to 'File'. In this case, Entity Developer will create a '[YourDataContext].xml' file which can be used to create the MappingSource object. Please try this approach and tell us if this helps.
Using the XML file generated for a SQL Server database may lead to errors, at least because this file describes column data types, which are different for PostgreSQL and SQL Server.
Generally, the proper way of preparing the XML mapping file is to set the "Mapping Mode" model property to 'File'. In this case, Entity Developer will create a '[YourDataContext].xml' file which can be used to create the MappingSource object. Please try this approach and tell us if this helps.
Using the XML file generated for a SQL Server database may lead to errors, at least because this file describes column data types, which are different for PostgreSQL and SQL Server.
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48