Multi tenant 从接口生成私有实现。
如何使ITenantConfiguration SessionFactory setter成为私有的,并且仍然能够通过租户类对其进行设置?我需要什么来重建它才能让它工作? 我希望ISessionFactory设置在租户创建内部,而不是外部Multi tenant 从接口生成私有实现。,multi-tenant,Multi Tenant,如何使ITenantConfiguration SessionFactory setter成为私有的,并且仍然能够通过租户类对其进行设置?我需要什么来重建它才能让它工作? 我希望ISessionFactory设置在租户创建内部,而不是外部 public interface ITenantConfiguration { ISessionFactory SessionFactory { get; /*make private setter here*/ set; } } public cla
public interface ITenantConfiguration
{
ISessionFactory SessionFactory { get; /*make private setter here*/ set; }
}
public class Tenant : ITenant
{
public ITenantConfiguration Configuration { get; set; }
public Tenant(ITenantConfiguration configuration)
{
Configuration = configuration;
//Configuration.SessionFactory = CreateConfig();
}
public ISessionFactory CreateConfig()
{
return Fluently
.Configure()
.Database(DatabaseConfiguration)
.Mappings(MapAssemblies)
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory();
}
//..... removed for clarity
}
public class TenantConfiguration : ITenantConfiguration
{
public NHibernate.ISessionFactory SessionFactory { get; /*private set;*/ set; }
public Dictionary<string, object> Properties { get; set; }
}
公共接口配置
{
ISessionFactory SessionFactory{get;/*在此处生成私有setter*/set;}
}
公共类租户:ITenant
{
公共配置{get;set;}
公用租户(ITenantConfiguration)
{
配置=配置;
//Configuration.SessionFactory=CreateConfig();
}
公共ISessionFactory CreateConfig()
{
流利地返回
.Configure()
.数据库(数据库配置)
.映射(映射程序集)
.ExposeConfiguration(构建架构)
.BuildSessionFactory();
}
//…为了清晰起见,请将其删除
}
公共类租户配置:ITenantConfiguration
{
public NHibernate.ISessionFactory SessionFactory{get;/*private set;*/set;}
公共字典属性{get;set;}
}
我只是把它们内部化了,就是这样,我应该想到这一点