sebastienros/fluid

Fluid ViewEngine in ASP.NET Core 6 SAAS Application does not reset ViewsLocationFormats for different Tenants

kashifasif opened this issue · 0 comments

Hi, I am using Fluid into ASP.NET Core 6 for an SAAS application and this application support that each tenant can upload or customize their own theme so this way each tenant has their own theme folder hierarchy like

  • Tenant 1 (tenant1.example.com): Themes -> Tenant1 -> Theme1 -> Pages -> Home.liquid
  • Tenant 2 (tenant2.example.com): Themes -> Tenant2 -> Theme2 -> Pages -> Home.liquid

And Some tenant can have themes from default themes which has different folder hierarchy like this

  • Tenant 3 (tenant3.example.com): Themes -> CommonThemes -> DefaultTheme -> Pages -> Home.liquid

So, i have configured the ViewsLocationFormats and ViewsFileProvider based on some condition so these are automatically configured and Format are generated.

Problem:
When i open Tenant 1 (tenant1.example.com) application, it succesfully loads the views and layout etc from own directory (Themes -> Tenant1 -> Theme1 -> Pages -> Home.liquid) but the problem thing is when other tenant try to open their application instance let say Tenan 3, Fluid automatically load Views from ViewsLocationFormats of Tenant 1 (tenant1.example.com) even ViewsLocationFormats should reset and should load views from their own directory. This is the case of all tenants and i have configured ConfigureOptions correctly.

After debuging the "FluidViewEngine" i have seen that inside "LocatePageFromViewLocations" method _options.ViewsLocationFormats never get reset. I expect that it should load new list from ConfigureOptions ni which i have confirure the ViewsLocationFormats and ViewsFileProvider and ConfigureOptions only invoked once at the start of application after publishing the application afterwards it never invoke again i think thats why it never get new View Formate List based.

So, can anyone please help me how i can achive it? Or i am doing something wrong in the code flow or this is default behavior of Fluid?

Note: for multitenancy i am using Finbuckle.

image

Thanks in advance!