Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to use distributed cache in a database per tenant app?

$
0
0

I have a database-per-tenant Blazor server-side app (using Finbuckle.Multitenant host strategy) and I'm implementing distributed cache. So what I'm trying to do in Startup is the following:

services.AddTransient<CacheResolver>(_ => connectionString =>{    Action<SqlServerCacheOptions> cacheConfigOptions = options =>    {        options.ConnectionString = connectionString;        options.SchemaName = "dbo";        options.TableName = "Cache";    };    services.Configure(cacheConfigOptions);    services.AddTransient<SqlServerCache>();    return sp =>    {        using var scope = sp.CreateScope();        return scope.ServiceProvider.GetRequiredService<SqlServerCache>();    };});

And I have also defined:

public delegate IDistributedCache CacheResolver(string key);

However I'm getting 2 errors:

On the connectionString

and

on retrun sp

How can I fix the above errors?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>