c# - Connection String Trouble MetaDataException -


i got 2 models in project. when added second models got error in account page:

system.data.metadataexception: specified schema not valid. errors: (8.6): error 0040: nclob type not qualified namespace or alias. primitive types can used without qualification.  @ line 34 of `initializesimplemembershipattribute.cs` :       using (var context = new userscontext()) ligne 33 :                     { ligne 34 :                         if (!context.database.exists()) ligne 35 :                         { ligne 36 :                             // create simplemembership database without entity framework migration schema 

and connection string :

<connectionstrings>     <add name="defaultconnection" connectionstring="user id=devart;password=1234;data source=localhost:1521" providername="devart.data.oracle" />     <add name="entities" connectionstring="metadata=res://*/models.modelmae.csdl|res://*/models.modelmae.ssdl|res://*/models.modelmae.msl;provider=oracle.dataaccess.client;provider connection string=&quot;data source=localhost:1521;password=1234;user id=test&quot;" providername="system.data.entityclient" />   </connectionstrings> 

usercontext connection string1 :

public class userscontext : dbcontext {     public userscontext()         : base("defaultconnection")     {     }      public dbset<userprofile> userprofiles { get; set; } } 

usercontext connectionstring 2 :

public class entitiesmae : dbcontext {      public entitiesmae() : base("name=entitiesmae")     {     }      public dbset<offre> offre { get; set; }      public dbset<region> region { get; set; } } 

the problem's in seconde connection string entities when remove every thing works. please how fix ?

this looks it's related problem:

http://forums.devart.com/viewtopic.php?t=21488

this article recommends 2 approaches. 1.disable conventions (i wouldn't recommend this) 2.use oracleentityproviderconfig configure workarounds.ignoreschemaname = true

they mention using specific dbcontext template, can find article (i hate posting links, there's way information there summarize):

http://blog.devart.com/entity-developer-ef-code-first-dbcontext-template.html

however, written ef 4.1, , don't version of ef you're using... i'm not sure if of still applies whatever version may using.

so gist can't replace provider no other changes. you're going have make other changes, , suggest generating code devart dbcontext template using similar code , see produces, put code in app.

also, code wrong. you're using connection strings don't exist (you the connection string called entities, code using connection string called entitiesmae), second context called usercontext, code called entitiesmae. suggest cleaning code has real code, because otherwise we're trying code isn't valid.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

c# - Convert XDocument to byte array (and byte array to XDocument) -