DefaultHibernateSessionManager läuft jetzt
This commit is contained in:
@@ -36,6 +36,17 @@
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Castle.Core, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\BeWoPlaner\Lib\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Castle.DynamicProxy">
|
||||
<HintPath>..\..\BeWoPlaner\Lib\Castle.DynamicProxy.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\BeWoPlaner\Lib\Castle.DynamicProxy2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Lib\log4net.dll</HintPath>
|
||||
@@ -44,6 +55,9 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Lib\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate.ByteCode.Castle">
|
||||
<HintPath>..\..\BeWoPlaner\Lib\NHibernate.ByteCode.Castle.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
@@ -60,15 +74,23 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Multitenancy\Symbol Edit.png" />
|
||||
<None Include="App.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<Content Include="Multitenancy\demo.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Data\Data.csproj">
|
||||
<Project>{b0d73e3d-4ae7-4024-93a6-db1f46d7ccee}</Project>
|
||||
<Name>Data</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Host\Host.csproj">
|
||||
<Project>{e1154c7b-bb77-4155-9854-dad8fc5a8bc3}</Project>
|
||||
<Name>Host</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Service\Service.csproj">
|
||||
<Project>{094331c3-ecee-4c89-bbfd-4c9ded89f0ef}</Project>
|
||||
<Name>Service</Name>
|
||||
|
||||
BIN
BeWoChatServer/Multitenancy/Symbol Edit.png
Normal file
BIN
BeWoChatServer/Multitenancy/Symbol Edit.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
19
BeWoChatServer/Multitenancy/debug.config
Normal file
19
BeWoChatServer/Multitenancy/debug.config
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
|
||||
</configSections>
|
||||
|
||||
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.0">
|
||||
<session-factory xmlns='urn:nhibernate-configuration-2.2'>
|
||||
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
|
||||
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
|
||||
<property name="connection.connection_string">Password=test;Persist Security Info=True;User ID=BeWoUser;Initial Catalog=BeWo;Data Source=SERVER01</property>
|
||||
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
|
||||
<mapping assembly="BeWo.Data" />
|
||||
</session-factory>
|
||||
|
||||
</hibernate-configuration>
|
||||
|
||||
</configuration>
|
||||
18
BeWoChatServer/Multitenancy/debugMsSQL.config
Normal file
18
BeWoChatServer/Multitenancy/debugMsSQL.config
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
|
||||
</configSections>
|
||||
|
||||
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.0">
|
||||
<session-factory xmlns='urn:nhibernate-configuration-2.2'>
|
||||
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
|
||||
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
|
||||
<property name="connection.connection_string">Password=test;Persist Security Info=True;User ID=BeWoUser;Initial Catalog=BeWo;Data Source=SERVER01</property>
|
||||
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
|
||||
<mapping assembly="BeWo.Data" />
|
||||
</session-factory>
|
||||
</hibernate-configuration>
|
||||
|
||||
</configuration>
|
||||
18
BeWoChatServer/Multitenancy/debugMySQL.config
Normal file
18
BeWoChatServer/Multitenancy/debugMySQL.config
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
|
||||
</configSections>
|
||||
|
||||
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.0">
|
||||
<session-factory xmlns='urn:nhibernate-configuration-2.2'>
|
||||
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
|
||||
<property name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</property>
|
||||
<property name="connection.connection_string">Server=localhost;Password=test;User ID=BeWoUser;Initial Catalog=bewodemo</property>
|
||||
<property name="dialect">NHibernate.Dialect.MySQLDialect</property>
|
||||
<mapping assembly="BeWo.Data" />
|
||||
</session-factory>
|
||||
</hibernate-configuration>
|
||||
|
||||
</configuration>
|
||||
40
BeWoChatServer/Multitenancy/demo.config
Normal file
40
BeWoChatServer/Multitenancy/demo.config
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
|
||||
</configSections>
|
||||
|
||||
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
|
||||
<session-factory>
|
||||
<property name="connection.provider">
|
||||
NHibernate.Connection.DriverConnectionProvider
|
||||
</property>
|
||||
<property name="connection.driver_class">
|
||||
NHibernate.Driver.MySqlDataDriver
|
||||
</property>
|
||||
|
||||
<property name="connection.connection_string">
|
||||
Server=localhost;Password=root;User ID=root;Initial Catalog=bewodemo
|
||||
</property>
|
||||
|
||||
<!--<property name="connection.connection_string">
|
||||
Server=localhost;Password=root;User ID=root;Initial Catalog=1234567890
|
||||
</property>-->
|
||||
|
||||
<property name="dialect">
|
||||
NHibernate.Dialect.MySQLDialect
|
||||
</property>
|
||||
<property name="proxyfactory.factory_class">
|
||||
NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle
|
||||
</property>
|
||||
<property name="hbm2ddl.keywords">none</property>
|
||||
<property name="show_sql">true</property>
|
||||
<property name="format_sql">true</property>
|
||||
|
||||
<mapping assembly="BeWo.Data" />
|
||||
</session-factory>
|
||||
</hibernate-configuration>
|
||||
|
||||
</configuration>
|
||||
Binary file not shown.
@@ -11,7 +11,7 @@ using log4net.Layout;
|
||||
using log4net.Repository.Hierarchy;
|
||||
using NHibernate;
|
||||
using NHibernate.Cfg;
|
||||
using Environment = System.Environment;
|
||||
|
||||
|
||||
namespace BeWo.Data
|
||||
{
|
||||
@@ -59,12 +59,15 @@ namespace BeWo.Data
|
||||
|
||||
var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||
var splittedBaseDirectory = baseDirectory.Split('\\'); // 0 -3
|
||||
var correctBaseDirectory = string.Empty;
|
||||
for(var i = 0; i < 4; i++)
|
||||
{
|
||||
|
||||
correctBaseDirectory += splittedBaseDirectory[i] + "\\";
|
||||
}
|
||||
|
||||
_SessionFactories[CurrentTenant] = new Configuration().Configure(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Multitenancy\" + CurrentTenant + ".config")).BuildSessionFactory();
|
||||
var test = correctBaseDirectory;
|
||||
|
||||
_SessionFactories[CurrentTenant] = new Configuration().Configure(Path.Combine(correctBaseDirectory, @"Multitenancy\" + CurrentTenant + ".config")).BuildSessionFactory();
|
||||
}
|
||||
|
||||
return _SessionFactories[CurrentTenant];
|
||||
|
||||
Reference in New Issue
Block a user