Column order not scaffolded as attribute
See original GitHub issueSee this in 7.0 RC1, when using DataAnnotations
modelBuilder.Entity<Shipper>(entity =>
{
entity.Property(e => e.ShipperId).HasColumnOrder(0);
entity.Property(e => e.CompanyName).HasColumnOrder(1);
entity.Property(e => e.Phone).HasColumnOrder(2);
});
public partial class Shipper
{
[Key]
[Column("ShipperID")]
public int ShipperId { get; set; }
[StringLength(40)]
public string CompanyName { get; set; } = null!;
[StringLength(24)]
public string? Phone { get; set; }
[InverseProperty("ShipViaNavigation")]
public virtual ICollection<Order> Orders { get; } = new List<Order>();
}
I was hoping for this:
public partial class Shipper
{
[Key]
[Column("ShipperID", Order = 0)]
public int ShipperId { get; set; }
[StringLength(40)]
[Column("CompanyName", Order = 1)]
public string CompanyName { get; set; } = null!;
[StringLength(24)]
[Column("Phone", Order = 2)]
public string? Phone { get; set; }
[InverseProperty("ShipViaNavigation")]
public virtual ICollection<Order> Orders { get; } = new List<Order>();
}
Issue Analytics
- State:
- Created a year ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
entity framework - EF7 Scaffolding not creating columns
I fixed the problem. First I had foreign key properties, so my models looked like this: public Order Order {get;set;} public Guid OrderId ......
Read more >ScaffoldColumnAttribute Class (System.ComponentModel. ...
It hides the ThumbnailPhotoFileName column by applying the scaffold property to the ThumbnailPhotoFileName object and setting it to false . C# Copy. [ ......
Read more >The Grid will not create columns for scaffolded = false column
Hello Vasile, Basically you can use the [HiddenInput(DisplayValue=false)] attribute to your model property. Or you can mark the column as ...
Read more >Features Of Entity Framework Core 2.1 - Better Column ...
Yes and No - The first thing to understand is that the logical order of columns in a table has an impact on...
Read more >Exploring Dynamic Data: Scaffolding attributes for business logic
Scaffolding is a term that describes letting the business logic determine the list of columns and tables displayed in your user interface.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah, we’re not supposed to scaffold that. We just use it to sort the CLR properties. (Which would then be used by Migrations to re-create the columns in the same order.)
Also surprised with scaffold this. I don’t think we should by default. /cc @bricelam