-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can Scaffold-DbContext generate entities with comments #19113
Comments
Implemented for SQL Server in 3.0 |
@netnr Are you asking for comments from the database to be converted to C# comments on entity types? For example: /// <summary>
/// This came from the database...
/// </summary>
public class Blog
{
...
} |
@ajcvickers Yes |
@netnr This is something that we would support as part of #4038. However, external tools such as those from @ErikEJ and @tonysneed may already support this through their templating mechanisms. |
@netnr Here is my scaffolding library: https://github.com/TrackableEntities/EntityFrameworkCore.Scaffolding.Handlebars. EF Core Power Tools by @ErikEJ also include my scaffolding library. |
@ajcvickers Any particular reason why this could not simply be in the product? |
@ErikEJ Do you really feel people want this behavior by default? /cc @bricelam @JeremyLikness |
Not 100% sure, I am making it the default for now in the daily build, but fail to see why it would be an issue. FWIW, EF Reverse POCO template has it enabled by default, and I cannot find any complaints about it. https://github.com/sjh37/EntityFramework-Reverse-POCO-Code-First-Generator/blob/master/EntityFramework.Reverse.POCO.Generator/Database%20NorthwindSqlCe40.tt#L84 - but then again I just found out who made it the default: sjh37/EntityFramework-Reverse-POCO-Code-First-Generator#16 😆 I also saw this: sjh37/EntityFramework-Reverse-POCO-Code-First-Generator@41a7eaa |
@ErikEJ Let's circle back round after it's been the default for a month or two. If there are still no complaints, then we should consider it. |
@ajcvickers Sounds good, I will do a release to MarketPlace soon then. |
@ajcvickers Power Tools with comments on by default has been released since May 2020, and I have not had a single complaint - except about bugs in my implementation 😆 This is what I currently have: private void WriteComment(string comment)
{
if (!string.IsNullOrWhiteSpace(comment))
{
_sb.AppendLine("/// <summary>");
foreach (var line in comment.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None))
{
_sb.AppendLine($"/// {System.Security.SecurityElement.Escape(line)}");
}
_sb.AppendLine("/// </summary>");
}
} |
Thanks for the update, @ErikEJ. |
I do this in my T4 templates by default too. Looking at Erik's code, I have a few bugs to fix... 😬 |
@bricelam yeah, that was also my initial implementation, until I faced some real life comments |
Are you planning to enable this in EF Core 6 ? (I could do a PR) |
I think we'd happily accept a PR for 6.0 |
fixes #19113 Co-authored-by: Erik Ejlskov Jensen <[email protected]>
Is this feature only for ef6? can be ported in current ef5? |
@Gambero81 EF Core 5.0 has already been released, and so is only receiving important bug fixes. See our release planning page for more details. |
@Gambero81 it is available in EF core power Tools for EF Core 5 |
Bring comments and swagger output interface more intuitive
The text was updated successfully, but these errors were encountered: