我使用实体框架和PostgreSQL视图映射视图,但是我得到了 无法加载指定的元数据资源错误,
这是我在做什么:
public class Custumers
{
[Table("v_at_customers", Schema = "zd")]
public class Customer
{
[Key]
[Column("customer_id")]
public int customer_id { get; set; }
public string organization { get; set; }
}
}
}
DbContext:
public partial class db_Entities : DbContext
{
public db_Entities()
: base("name=LTW")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public DbSet<Customer> Customer { get; set; }
}
这是我在控制器中得到错误的地方:
db_Entities dt = new db_Entities();
var s=(from t in dt.Customer
select new
{
Customeress=dt.customer_id
}).Take(5);