Cant Add controller which uses Class which is inherited from other class

前端 未结 1 1367
暖寄归人
暖寄归人 2021-01-14 21:24

I\'m using Entity Framework and MVC3, and my problem is that I can\'t scaffold Controllers if the class inherits from another Class.

Example:

This is Base Cl

相关标签:
1条回答
  • 2021-01-14 21:54

    The MVC AddController window check for a property DbSet of the ModelType you are adding. You should do like vicentedealencar said, add to your CRMWebContainer:

    [Obsolete("Design only", true)]
    public DbSet<Lead> Leads { get; set; }
    

    Remember that u should not use this property in your code (this is why the Obsolete Attribute), since the right way to get the Leads is using:

    var leads = Companies.OfType< Lead >();
    
    0 讨论(0)
提交回复
热议问题