I'm looking at an example from Microsoft on how to integrate MSAL and while looking at the code, I noticed they were using EntityTableData which is defined as an abstract class in Microsoft.AspNetCore.Datasync.EFCore which is required to use data off line but the class is an abstract class with the Id defined as follows:
public abstract class EntityTableData : ITableData
{
[Key]
public virtual string Id { get; set; }
...
}
I'm not sure I need to handle offline data yet, but let's assume I do for now, so I'd like to understand what you're supposed to do to handle this but have a different id type.
I thought I'd follow the example but I would have prefer having an INT/BIGINT or a GUID as an Id instead. I know I could use a shadow property as follows:
public class MyClass : EntityTableData
{
public int MyId { get; set; }
[Key]
public override string Id
{
get => MyId.ToString();
set => MyId = int.Parse(value);
}
public int MyId
{
get => NumericId;
set => NumericId = value;
}
}
but it does not feel right to design it like this. Maybe it is but if someone with more experience could clarify how to best handle a scenario where your Id is supposed to be a different type than string but how to support offline data as well would be great.
Thanks