I got two models in my project. When I added the second models I got this error in all account page:
System.Data.MetadataException: The specified schema is not valid. Errors:
(8.6): error 0040: the nclob type is not qualified with a namespace or alias. Only primitive types can be used without qualification.
At line 34 of `InitializeSimpleMembershipAttribute.cs` :
using (var context = new UsersContext())
Ligne 33 : {
Ligne 34 : if (!context.Database.Exists())
Ligne 35 : {
Ligne 36 : // Create the SimpleMembership database without Entity Framework migration schema
and those my 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="DATA SOURCE=localhost:1521;PASSWORD=1234;USER ID=TEST"" 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 I remove it every thing works.
Please How to fix it ?
This looks like it's related to this problem:
http://forums.devart.com/viewtopic.php?t=21488
This article recommends two approaches. 1.Disable Conventions (I wouldn't recommend this) 2.Use OracleEntityProviderConfig to configure Workarounds.IgnoreSchemaName = true
They also mention using a specific DbContext Template, which you can find from this article (I hate just posting links, but there's way too much information there to summarize):
http://blog.devart.com/entity-developer-ef-code-first-dbcontext-template.html
However, this was written for EF 4.1, and you don't say what version of EF you're using... so i'm not sure if any of this still applies to whatever version you may be using.
So the gist is that you can't just replace the provider with no other changes. You're going to have to make some other changes, and I would suggest generating code with the DevArt DbContext template using similar code and see what it produces, then put that code in your app.
Also, your code is obviously wrong. You're using connection strings that don't exist (You say the the connection string is called Entities, but your code is using a connection string called EntitiesMAE), you also say your second context is called UserContext, but your code is called EntitiesMAE. I suggest cleaning up your code so that it has your REAL code, because otherwise we're just trying to help you with code that isn't valid.
来源:https://stackoverflow.com/questions/23268037/connection-string-trouble-metadataexception