Efcore: How to set Column Description

Created on 16 Nov 2016  路  4Comments  路  Source: dotnet/efcore

I've read the docs, browsed the source and applied my Google and Bing Foo but can not determine
How to set the description on a SQL column using EF Core Code First.

Help!

closed-question

Most helpful comment

modelBuilder.Entity()
.Property(e => e.MyProperty)
.HasComment("My Column Description");

All 4 comments

There is no native API to do it. You would need to use the Sql(string) method in a migration to set the description.

Is there any plans to implement this? My boss just mandated that we start applying a description to every column we create from now on, and we are heavily using EF Core. I'd much rather be able to use Data Annotations to generate these than manual Sql(string) calls.

@NArnott This is being tracked by #15037. It is likely also possible to flow your own annotations through to Migrations, but it's not super easy to do right now--see #10258.

modelBuilder.Entity()
.Property(e => e.MyProperty)
.HasComment("My Column Description");

Was this page helpful?
0 / 5 - 0 ratings