-
-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use TKey for TenantId column #845
Comments
Hi, it was a design decision that fit the original use case I had long ago and now I’m stuck with it. I plan to abstract it out but it involves changes almost everywhere in the code. It also makes using the library messier since you have to pass your key around everywhere. For EFCore purposes there are value conversions which can help: |
Could you give an example? I’m thinking of making the change myself, but don’t want to end up introducing another issue or maintaining a separate fork. Would you suggest using EF value conversions instead? |
I don't have a good example to share unfortunately. I recommend isolating such a change to the database via ef setup as described in the link above to minimize any other potential problems. However I would first make sure that using strings is in fact impacting performance before worrying about it too much One thing you can do is in your tenant creation logic use a guid as the ID which is saved and used as a string-- that is what ASP.NET Core Identity does (of course it lets you use your own key type...) |
It looks like
IsMultiTenant()
is hard-coded to usestring
for TenantId column. I'm curious as to why not use TKey instead? In most cases I'd rather useGuid
for storing tenant Ids.The text was updated successfully, but these errors were encountered: