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