can't instantiate Entities context

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
nesteban
Posts: 1
Joined: Wed 19 Dec 2012 08:44

can't instantiate Entities context

Post by nesteban » Wed 19 Dec 2012 09:00

Hi,

We just migrate from VS20120 to VS2012, and I our sqlite connector doesn't work anymore. So we migrate to devart sqlite connector (we use trial for now but will probably use team licence if it does the job).

We choosed Database first option, as we already have a database set.

With devart connector, we managed to generate our model. It upgrades our connection string in app.config; like this

Code: Select all

    <add name="ExpertEntitiesConnectionString" connectionString="metadata=res://*/Expert.DB.ExpertModel.csdl|res://*/Expert.DB.ExpertModel.ssdl|res://*/Expert.DB.ExpertModel.msl;provider=Devart.Data.SQLite;provider connection string="Data Source=D:\reps\ourdb.s3db""
      providerName="System.Data.EntityClient" />
But when we try to instantiate our Entities context,

Code: Select all

ExpertEntities  ctx = new ExpertEntities();
the generated code for our ExpertEntities is :

Code: Select all

/// <summary>
        /// Initialize a new ExpertEntities object.
        /// </summary>
        public ExpertEntities() : 
                base(@"name=ExpertEntitiesConnectionString", "ExpertEntities")
        {
            OnContextCreated();
        }
we got an error :

In french : "Message = "La connexion nommée spécifiée est introuvable dans la configuration, n'est pas destinée à être utilisée avec le fournisseur EntityClient ou n'est pas valide."

We could translate it to : "the named connexion specified is not found in configuration, or is not designed to be used with ENtityClient provider or is not valid.


This code worked with our previous connector, we certainly miss something but we don't know what.

Any advises on this issue ?

Thanks in advance

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: can't instantiate Entities context

Post by Shalex » Fri 21 Dec 2012 11:29

nesteban wrote:the named connexion specified is not found in configuration, or is not designed to be used with ENtityClient provider or is not valid
1. Make sure that the *.config with "ExpertEntitiesConnectionString" is used by your application (this is actual for solutions with several projects): only *.config of startup project is employed.
nesteban wrote:We just migrate from VS20120 to VS2012, and I our sqlite connector doesn't work anymore. So we migrate to devart sqlite connector
2. You were using System.Data.SQLite, weren't you?
3. Specify the steps you have followed when migrating, e.g.:
a) droped old *.edmx with System.Data.SQLite and created new *.edml with Devart.Data.SQLite;
b) opened old *.edmx with System.Data.SQLite in Entity Developer, changed used provider to Devart.Data.SQLite, regenerated storage part, saved as *.edml;
c) etc.
4. Are you currently working with Devart.Data.SQLite via *.edmx or *.edml? If possible, send us a small test project to reproduce the issue in our environment.

Post Reply