Error creating DataContext

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Posts: 1
Joined: Wed 14 Sep 2011 16:54

Error creating DataContext

Post by SomeDeveloper » Wed 14 Sep 2011 17:06

I'm getting an error creating a data context instance. This started happening after I changed a column to Nullable = FALSE and updated the database from the model.

Can you please help? If needed I can send the project via email.

Error: InvalidOperationException("You should use the constructor with XmlMappingSource parameter");

Database: SQLite
.NET: 4.0, C#
VS Version: 2010 SP1
Entity Developer Version: 4.0.3

Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 15 Sep 2011 14:04

This exception specifies that the 'File' mapping mode is set for the model, and no mapping source was passed to the data context constructor.

To resolve this, you can do either of the following:
1. Set the mapping mode to 'Attributes' and save the model (so that the code is re-generated).
2. If you do use the file mapping (e.g., you have to if you are working with POCO classes), create the XmlMappingSource object from the special .xml file generated by Entity Developer:

Code: Select all

XmlMappingSource mappingSource =
var context = new [YourDataContext](mappingSource);
Please tell us if this helps.

Post Reply