【发布时间】:2018-04-10 15:21:24
【问题描述】:
我试图在我的解决方案中添加一个 db-Migration。但它退出并出现以下错误:
System.Data.Entity.Core.MetadataException: Schema specified is not valid. Errors:
(0,0) : error 0040: The Type NVARCHAR2 is not qualified with a namespace or alias. Only primitive types can be used without qualification.
(0,0) : error 0040: The Type TIMESTAMP is not qualified with a namespace or alias. Only primitive types can be used without qualification.
(0,0) : error 0040: The Type NCLOB is not qualified with a namespace or alias. Only primitive types can be used without qualification.
... (more errors are following)
这是我的 DbMigrationsConfiguration:
using System.Data.Entity.Migrations;
using Devart.Data.Oracle.Entity.Migrations;
namespace ProductInformation.Migrations
{
public sealed class Configuration : DbMigrationsConfiguration<ProductInformationContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
SetSqlGenerator(OracleConnectionInfo.InvariantName,
new OracleEntityMigrationSqlGenerator());
}
protected override void Seed(ProductInformationContext context)
{
}
}
}
还有我的 DbContext:
using System.Data.Entity;
namespace ProductInformation
{
public sealed class ProductInformationContext : DbContext
{
static ProductInformationContext()
{
var config = Devart.Data.Oracle.Entity.Configuration.OracleEntityProviderConfig.Instance;
config.CodeFirstOptions.RemoveSchemaFromDefaultConstraintName = true;
config.CodeFirstOptions.TruncateLongDefaultNames = true;
config.Workarounds.IgnoreDboSchemaName = true;
config.DmlOptions.BatchUpdates.Enabled = true;
}
public ProductInformationContext()
: base("name=ProductInformationConnectionString")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Price>().Property(p => p.Value).HasPrecision(8, 2);
}
// some other DbSet
public DbSet<Price> Prices { get; set; }
}
}
我不知道错误来自哪里以及如何解决它。 我已经尝试了 ColumnTypeCasingConventionCompatibility 设置,但它没有解决错误。
dotConnect for Oracle 9.5.454.0
英孚 6.2.0
.NET 4.6.1
甲骨文 12c
【问题讨论】:
标签: c# entity-framework-6 ef-code-first devart