连接字符串麻烦MetaDataException

我的项目中有两个模型。 当我添加第二个模型时,我在所有帐户页面中都出现了此错误:

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 

那些我的连接字符串:

     

usercontext连接String1:

 public class UsersContext : DbContext { public UsersContext() : base("DefaultConnection") { } public DbSet UserProfiles { get; set; } } 

UserContext connectionString 2:

 public class EntitiesMAE : DbContext { public EntitiesMAE() : base("name=EntitiesMAE") { } public DbSet OFFRE { get; set; } public DbSet REGION { get; set; } } 

当我删除它时,seconde连接字符串entities的问题是有效的。 请问如何解决?

这看起来与此问题有关:

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

本文推荐两种方法。 1.Disable Conventions(我不建议这样做)2。使用OracleEntityProviderConfig配置Workarounds.IgnoreSchemaName = true

他们还提到了使用特定的DbContext模板,你可以在这篇文章中找到它(我讨厌发布链接,但是有太多的信息要总结):

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

但是,这是为EF 4.1编写的,你没有说你正在使用的EF版本……所以我不确定这些版本是否仍然适用于你可能使用的任何版本。

因此,要点是您不能只更换提供程序而不进行其他更改。 您将不得不进行一些其他更改,我建议使用类似的代码使用DevArt DbContext模板生成代码并查看它产生的内容,然后将该代码放入您的应用程序中。

此外,您的代码显然是错误的。 您正在使用不存在的连接字符串(您说连接字符串称为实体,但您的代码使用名为EntitiesMAE的连接字符串),您还说您的第二个上下文称为UserContext,但您的代码称为EntitiesMAE 。 我建议清理你的代码,使其具有你的真实代码,否则我们只是试图帮助你使用无效的代码。