Entity framework core 如何将HasComment中的EF核心模型配置实体属性comment设置为html标题属性

Entity framework core 如何将HasComment中的EF核心模型配置实体属性comment设置为html标题属性,entity-framework-core,modelmetadata,ef-model-builder,Entity Framework Core,Modelmetadata,Ef Model Builder,尝试将html元素的title属性设置为传递给entity.Property().HasComment(comment)方法的参数 我试过了,但运气不好: <label asp-for="OrganizationTypeId" title="@ViewData.ModelMetadata.Description"> OnModelCreating方法设置以下内容时,该值为null: modelBuilder.Entity<Organ

尝试将html元素的title属性设置为传递给entity.Property().HasComment(comment)方法的参数

我试过了,但运气不好:

<label asp-for="OrganizationTypeId" title="@ViewData.ModelMetadata.Description">

OnModelCreating方法设置以下内容时,该值为null:

modelBuilder.Entity<Organization>(entity =>
{
   entity.Property(e => e.OrganizationTypeId).HasComment("Foreign key of the Org...");
modelBuilder.Entity(Entity=>
{
Property(e=>e.OrganizationTypeId).HasComment(“组织的外键…”);
此注释可用作html属性吗


感谢

显示了如何检索模型的注释。

请参阅DbContext扩展方法,该方法显示了如何检索模型的注释,但提供了显示注释的完整路径。该方法显示了windows窗体中的用法(是的,它不是ASP.NET)但是给出了一个如何获取模型注释的想法。应该足以用于代码中。谢谢你,Karen。非常有魅力。向你致意