Closed as not planned
Closed as not planned
Description
openedon Oct 22, 2023
With data annotations you get db-first code like this:
[Index("Id")]
[PrimaryKey("Id")]
public class Post
{
public int Id { get; set; }
[ForeignKey("BlogKey")]
public Blog Blog { get; init; }
}
It would be much more error-prone to use “strongly typed” nameof
version when possible during reverse engineering:
PrimaryKey(nameof(First), nameof(Second)]
.- string interpolation for foreign keys
[ForeignKey($"{nameof(First)}, {nameof(Second)}")]
.
This is especially useful if user would like to rename the property after scaffolding:
class Item
{
[Column("ActualNameInDb")]
public string Property {get; set;}
}
Also one could easily see “usages” of the property when it’s referenced not via a magic string but a nameof
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment