I need advice on implementing a composite key on a Syncfusion for a Blazor Datagrid. It does not allow composite keys and the ticket to add it as a feature has sat unmoved for a few years now.
This is the TimeUnit class that uses a composite key of ID and Valid From Date:
public class TimeUnit { public Int16 timeUnitID { get; set; } public DateTime validFrom { get; set; } public DateTime? validTo { get; set; } public string description { get; set; } public Nullable<Int16> days { get; set; } public Common.SpecialProcessing specialProcessing { get; set; } public DateTime dateLastActivity { get; set; } }And this an extract from dbContext where the key is defined
builder.Entity<TimeUnit>().HasKey(table => new { table.timeUnitID, table.validFrom });That format has stood the test of time through Windows Froms, WPF, and Angular using PrimeNG. But not Syncfusion for a Blazor Datagrid.
I'm thinking of adding something like
[Not Mapped]public Int16 timeUnitID { get; set; }to the class and filling it with sequential integers after the fetch. I could offer it as a sacrifical key to the Syncfusion Blazor Datagrid.
The attributes of a TimeUnit ID can be different at different points in time - this applies to many of my definitions, so this key format needs to persist.
I am asking for suggestions on a workaround before I pursue the one I have outlined here.