我试图在我的项目中添加新控制器,但是我收到了这个错误:
unable to retrieve metadata for 'MvcApplication1.Models.REGION" object reference not set to instance of object.
这是我的连接字符串:
<`add name="EntitiesRegion" connectionString="metadata=res://*/Models.region.csdl|res://*/Models.region.ssdl|res://*/Models.region.msl;provider=Oracle.DataAccess.Client;provider connection string="DATA SOURCE=localhost:1521;PASSWORD=1234;USER ID=TEST"" providerName="System.Data.EntityClient" />`
她的内容是 region.Context.cs :
namespace MvcApplication1.Models
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class EntitiesRegion : DbContext
{
public EntitiesRegion()
: base("name=EntitiesRegion")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public DbSet<REGION> REGION { get; set; }
}
}
我还使用 Oracle数据库和实体框架5 。请帮忙。