EFCore.DbComment
Add comment for objects (table, column) from code to database. You can use it with xml comment summary or Description clr attr.
/// <summary>User</summary>
public class User
{
/// <summary>Full name</summary>
public string Name { get; set; }
}
In DbContext.OnModelCreating(ModelBuilder builder) insert
modelBuilder.CommentModelFromXml();
And then you can do dotnet ef migrations add ...
Don't forget to enable XML documentation
[Description("User")]
public class User
{
[Description("Full name")]
public string Name { get; set; }
}
In DbContext.OnModelCreating(ModelBuilder builder) insert
modelBuilder.CommentModelFromDescriptionAttr();
If you inherit entities from classes from nuget packages, you should also enable packaging xml documentation in packages and enable copying their documentation to output directory.
To copy XmlDocs, you need to add section to your startup project .csproj
or Directory.Build.props
:
<Target Name="_ResolveCopyLocalNuGetPackagePdbsAndXml" Condition="$(CopyLocalLockFileAssemblies) == true" AfterTargets="ResolveReferences">
<ItemGroup>
<ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).xml')" Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)' != '' and Exists('%(RootDir)%(Directory)%(Filename).xml')" />
</ItemGroup>
</Target>