Comments to fields of PostgreSQL tables are not generated

Hi.

I created a table in a PostgreSQL database with comments on the tables and fields of these tables. If I use the command line, like this:

dotnet ef dbcontext scaffold "Host=MyHostAddr;Username=MyUser;Password=MyPassword;Database=MyDatabase" Npgsql.EntityFrameworkCore.PostgreSQL --context-dir Data1 --output-dir Models1 --data-annotations --force

the comments to the fields of the table I see in the following generated code:

protected override void OnModelCreating(ModelBuilder modelBuilder)
 {
 modelBuilder.Entity<MyTestTable>(entity =>
 {
 entity.HasComment("Comment for MyTestTable");
 entity.Property(e => e.Id).HasComment("Comment for ID field");
 ............................................
 });
 OnModelCreatingPartial(modelBuilder);
 }

But if I use "Data" from Radzen Blazor Studio for the same tool, then I don't find these comments anywhere in the project.

Is this the expected behavior of Radzen Blazor Studio, or is it a bug, or maybe I'm doing something wrong?

Hi @Alex10,

Indeed Radzen Blazor Studio does not generate comments.

Are there plans to implement this feature in the future?

We probably would but it isn't high on our priority list. As far as I understand it is mostly used in code-first scenarios. What do you use comments for in a db-first case?

Comments in the database should be in any case, so that other developers and DB administrators understand what these tables and fields are for. This is usually the requirement of our Customer.
Now I have little experience, so I'm looking at exactly how Radzen Blazor Studio generates classes based on a ready-made database and, so to speak, I'm learning from him, trying to understand why everything is done this way and not otherwise.
Probably in the future I will use the Code First approach when I finally realize that I understand it. But even in this case, I will need to somehow write comments to the database that is created based on the migration from the code. So I'm trying to figure out how to do it.

I have another (possibly delusional) idea of how the comments contained in the database could be used in addition to what Microsoft is doing.

Suppose we have a table:

create table "Depatments"
(
  "Id" serial constraint depatments_pk primary key,
  "Name" varchar(50) not null,
  .........................................................
  "WhatTheFck" varchar(666) not null,
  ..........................................................
);
create unique index depatments_whatthefck_uindex on "Depatments" ("WhatTheFck");

comment on table "Depatments" is 'List of departments of the company';
comment on column "Depatments"."Id" is 'Primary key';
.........................................................................................
comment on column "Depatments"."Name" is 'Short name of the department';
.........................................................................................
comment on column "Depatments"."WhatTheFck" is 'In this field to record so-and-so...';
.........................................................................................

What if, when generating a class, do something like this:

  /// <summary>
  /// List of departments of the company
  /// </summary>
  [Table("department", Schema = "public")]
  public partial class Department
  {
    /// <summary>
    /// Primary key
    /// </summary>
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int Id { get; set; }

    /// <summary>
    /// Short name of the department. Required, max 50 chars 
    /// </summary>
    [Required]
    public string Name { get; set; }

    .............................................................................................

    /// <summary>
    /// In this field to record so-and-so... . Required,unique,max 666 chars.
    /// </summary>
    [Required]
    [...]
    ..... 
    public string WhatTheFck { get; set; }

    ..............................................................................................
  }

In this case, thanks to the capabilities of Intellisence, the application programmer will see exactly what he is dealing with every time he accesses an object or properties. It seems to me that it will be easier for him, and he will be able to make fewer mistakes (for example, when filling in properties with some values).