I am trying to create a class which all my entities will extend in order to ensure that all required columns are there such as CreatedAt
, UpdatedAt
, Id
.
I am trying to get the timestamps after all columns, however using the order inside of the Column
attribute this does not seem to be working, but I believe this to be because all my other columns don't have an order on but I think this is a bit laboursome so was trying to do this automatically from the base class.
public class BaseEntity
{
public int Id { get; set; }
[Column("CreatedAt", Order = 9998 )]
public DateTime CreatedAt { get; set; }
[Column("UpdatedAt", Order = 9999 )]
public DateTime UpdatedAt { get; set; }
}
Is there anyway to automatically doing this without having to specify the order on every property?