Closed steebwba closed 5 years ago
Hi @steebwba thanks for posting this issue, I think you might have found a bug and I am taking a closer look.
Just to double check-- the code snippet above is from TryAdd, but you are seeing the issue in TryUpdate right? (Which is 99% the same as TryAdd, except it should skip the update on an existing item as you noted)
In TryUpdate I found this
var existing = await TryGetAsync(tenantInfo.Identifier);
Yikes! It should be passing tenantInfo.Id
not identifier and then the check should be == null after that.
I'll get this fixed (and add unit tests) for the next release.
Sorry, I did mean to reference TryUpdateAsync, rather than TryAddAsync! I did make adjustments to the method, but it broke the unit tests for the method so then I started to wonder if it was intended after all!
Hi,
I have tried implementing a custom store and also tried with the provided stores, but when I try to update existing tenant info using TryUpdateAsync on the store, the return value is false. From what I can see in MultiTenantStoreWrapper, if the result of TryGetAsync isn't null, so a tenant is found, then the update is skipped.
https://github.com/Finbuckle/Finbuckle.MultiTenant/blob/c5877b0ba7377c9010ac381c56f2585c9f0d87e7/src/Finbuckle.MultiTenant.Core/Stores/MultiTenantStoreWrapper.cs#L125-L130
When looking at the EFCoreStore, the opposite occurs and it will update details when the tenant is found. What I don't understand is, how would the code in EFCoreStore get called.
It appears as though the two areas are conflicting, whereas I would imagine that the update should occur only if the tenant does exist, instead of when it doesn't