如何获取HasComment中设置的EF Core模型配置实体属性注释作为html标题属性



尝试将html元素的title属性设置为传递给实体的参数。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...");

此注释是否可用作html属性?

感谢

这个DbContext扩展方法展示了如何检索模型的注释。

最新更新