如何在SQL视图中使用数据注释? MVC& EF6

时间:2017-01-24 08:01:43

标签: entity-framework-6 asp.net-mvc-5

我的数据库包含表格和视图。我可以使用"数据注释"与表:),但我失败了观点:(。 我使用元数据类在EF生成的类上应用数据注释。

class V_TasksList_MD
{

    [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
    public Nullable<System.DateTime> SubmitDate { get; set; }


    [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
    public System.DateTime StartDate { get; set; }


    [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
    public System.DateTime DueDate { get; set; }


    [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
    public Nullable<System.DateTime> ProgressDate { get; set; }


    [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
    public Nullable<System.DateTime> CompleteDate { get; set; }


    [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
    public Nullable<System.DateTime> ApproveDate { get; set; }


}

[MetadataType(typeof(V_TasksList_MD))]
public partial class V_TasksList
{

}

0 个答案:

没有答案