简体   繁体   English

将文档添加到实体框架生成的实体

[英]Add documentation to entity framework generated entities

T4 enerate for me some entities like this : T4为我激发了一些像这样的实体:

public partial class Use
{

    public int UseId { get; set; }
    public int ProgramId { get; set; }
    public System.DateTime InUseDate { get; set; }
}

i whant to add documentation to this entity. 我希望向该实体添加文档。 i proceed like folowing: 我像以下那样进行:

[MetadataType(typeof(UseData))]
public partial class Use { 

}
public class UseData
{
    /// <summary>
    /// This is an ID
    /// </summary>
    [Display(
        Name = "Use ID",
        Description = "This is an ID Desc")
    ]
    public int UseId;
}

but VS autocomplete dont show me the summary of my UseIdattribute. 但是VS自动填充功能不会向我显示我的UseIdattribute的摘要。

any ideas 有任何想法吗

If you're using an EDMX all you have to do is go to the entity property in the designer, open the Visual Studio properties tab and fill in the documentation 如果您使用的是EDMX,那么您要做的就是转到设计器中的实体属性,打开“ Visual Studio属性”选项卡并填写文档。 VS EDMX属性的屏幕截图 .

Generates code with xml summary... 生成带有xml摘要的代码...

    /// <summary>
    /// Database and Application Version
    /// </summary>
    [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
    [DataMemberAttribute()]
    public global::System.Int32 MajorVersion
    {
        get
        {
            return _MajorVersion;
        }
        set
        {
            if (_MajorVersion != value)
            {
                OnMajorVersionChanging(value);
                ReportPropertyChanging("MajorVersion");
                _MajorVersion = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("MajorVersion");
                OnMajorVersionChanged();
            }
        }
    } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM