Finbuckle.MultiTenant icon indicating copy to clipboard operation
Finbuckle.MultiTenant copied to clipboard

Support for setting TenantInfo without using a store

Open priyankasyal opened this issue 2 years ago • 3 comments

Hi, I have a use-case where I have different use-cases for injecting tenant information as follows:

  • For one strategy I need to access the remote store to get tenant information and this works fine
  • For other strategy's I want to resolve tenant information locally (by setting the tenantInfo object based on identifier received), Ideally I don't even need a store for it and would like to just set the identifier information as received in the the tenantInfo object, because I just need to pass it on and not validate it for my use-case. I would like to avoid calling any remote stores or keeping a local info object as it will create an overhead of syncing, or doing extra calls which are not needed.

Is there a way to solve the second issue? I am pretty new to using finbuckle so I might be missing something here. Thanks Priyanka

priyankasyal avatar Aug 03 '23 11:08 priyankasyal

You can write your own middleware and call TrySetTenantInfo() function attachted to HttpConntext to manually set TenantInfo or you could manually attach TenantInfo to your DbContext if you have reference to TenantInfo in your DbContext.

turkysha avatar Jan 15 '24 15:01 turkysha

Hi turkysha,

I am using below modules in FinBuckle

  1. Strategy - Delegate Strategy - To get tenant identifier from the request URL
  2. Store - Http Remote Store - To get tenant details via API of an another service

While implementation I have noticed that for every incoming requests API call was initiated to get tenant details. But I am expecting as, once tenant details was retrieved it needs to be reused for upcoming requests, instead of initiating another API call for getting same tenant details.

Can you confirm,

  • do I need to implement custom logic to attain this provision or
  • whether this scenario can be achieved using FinBuckle?

Please share your suggestion on this requirement. Thanks in advance.

kesavan-m-19 avatar Jul 02 '24 07:07 kesavan-m-19

@kesavan-m-19 and @priyankasyal

Check out PR #805 if contains an echo store which is kind of a dummy store that returns a tenant info with the identifier set and no db or api calls.

AndrewTriesToCode avatar Jul 05 '24 20:07 AndrewTriesToCode