6
属性类型
我已经在上下文中添加Dbset即可访问性不一致:在的DbContext
public Dbset<Demo> Demo{ get; set; }
,但我在这里得到编译错误,即
Error 1 Inconsistent accessibility: property type 'System.Data.Entity.DbSet<MVC.Model.Demo>' is less accessible than property 'MVC.Model.Demo' D:Files/project 210 34 MVC.Data
这里是我的模型: -
class Demo
{
[Key]
[Display(Name = "ID", ResourceType = typeof(Resources.Resource))]
public long Id { get; set;}
[Display(Name = "CountryID", ResourceType = typeof(Resources.Resource))]
public long CountryId { get; set; }
[Display(Name = "RightID", ResourceType = typeof(Resources.Resource))]
public long RightId { get; set; }
[Display(Name = "Amount", ResourceType = typeof(Resources.Resource))]
public double Amount { get; set; }
}
如果我从上面的代码中删除“公共”,那么它会成功编译,但是然后我无法从控制器页面访问分配模型。那么该怎么做? – user3206357
@ user3206357 - 您需要公开分配。 – acarlon
@ user3206357 - 查看更新。 – acarlon