using core boilerplate framework 3.3.2 (latest doco i could see was for 3.2.1).
So i'm attempting to implement as db/tenant configuration.
To my delight I saw there was actually a class called DbPerTenantConnectionStringResolver
- fantastic!
In my EntityFrameworkModule
I add to the override PreInitialize()
method by adding the following line:
Configuration.ReplaceService<IConnectionStringResolver, DbPerTenantConnectionStringResolver>(DependencyLifeStyle.Transient);
However this does not compile:
The non-generic method 'IAbpStartupConfiguration.ReplaceService(Type, Action)'
cannot be used with type arguments CCRE.EntityFrameworkCore
Hopefully somebody can set me on the right track...
Add the following namespace:
using Abp.Configuration.Startup;
That accesses this extension method:
public static void ReplaceService<TType, TImpl>(this IAbpStartupConfiguration configuration, DependencyLifeStyle lifeStyle = DependencyLifeStyle.Singleton)
where TType : class
where TImpl : class, TType
{
configuration.ReplaceService(typeof(TType), () =>
{
configuration.IocManager.Register<TType, TImpl>(lifeStyle);
});
}