Make ITenantInfo's Id type a generic
Change ITenantInfo's Id type to a generic to allow for more flexibility when implementing the library. This would help since here, even if the Id is a number in the tenant store or the database, it needs to be converted into a string.
Essentially, change this :
public interface ITenantInfo
{
string? Id { get; set; }
}
To this :
public interface ITenantInfo<TKey>
{
TKey? Id { get; set; }
}
And keep the default TenantInfo to a string :
public class TenantInfo : ITenantInfo<string>
This is a big breaking change though, with lots of refactoring to do 😐. (realized this could be a duplicate of #365)
Hi, yes this on my todo list. And I plan to tackle it soonish.
Should the interface be this instead? Feels wrong to force it to be nullable as in the OP.
public interface ITenantInfo<TId>
{
TId Id { get; set; }
}
You would then use it like this for compatibility:
public class TenantInfo : ITenantInfo<string?>
Alternatively, you could also force the ID to be immutable, and never null (as I would personally expect) and have a huge refactor 😅
public interface ITenantInfo<TId>
where TId : notnull
{
TId Id { get; init; }
}
It would be a great improvement if we could change the type to something other than a string. I've been shouted at today (not really, but almost) that the TenantId is a string in our SQL database. I'm inclined to agree, so I was wondering if there are any plans to work on this soon?
I am working on it but it's nontrivial and will cause breaking changes because some areas assume a string... great thinking on my part years ago. I do plan to include this soon. I'm wrapping it up with a few other breaking changes for a single major release bump.