2011-01-17 8 views
0

マルチテナントの各テナントにカスタムNHibernate.Searchディレクトリを使用できるように、S#arpアプリケーションでnhibernateを流暢に構成する必要がありますアプリ。S#arpアーキテクチャ1.9 + Fluently.Configure()NHiberbante

しかし私は何時間も解決策を探しているが、現在動作しているものは何も見つけられないようだ。

おかげで、 ポール

答えて

0

私はこれを試していませんが、AddConfigurationはcfgPropertiesの辞書を取ります。これはテナント固有のhibernate.search.default.indexBase値を渡すことができます。

これを見て、上記のようにキーを追加すると、nullを返すのでCfgHelper.LoadConfiguration()を使用しようとすると問題が発生します。

しかし、あなたは工場出荷時のキーを使用して、各工場ごとに異なるディレクトリを使用するNHSearchを設定できます。

<nhs-configuration xmlns="urn:nhs-configuration-1.0"> 
    <search-factory sessionFactoryName="YOUR_TENANT1_FACTORY_KEY"> 
     <property name="hibernate.search.default.indexBase">~\IndexTenant1</property> 
    </search-factory> 
    <search-factory sessionFactoryName="YOUR_TENANT2_FACTORY_KEY"> 
     <property name="hibernate.search.default.indexBase">~\Tenant2</property> 
    </search-factory> 
    </nhs-configuration> 

あなたは http://wiki.sharparchitecture.net/Default.aspx?Page=NHibSearch 上の指示に従っている場合は、

private string GetIndexDirectory() { 
    INHSConfigCollection nhsConfigCollection = CfgHelper.LoadConfiguration(); 
    string factoryKey = SessionFactoryAttribute.GetKeyFrom(this); // Change this with however you get the factory key for your tenants, 
    string property = nhsConfigCollection.GetConfiguration(factoryKey).Properties["hibernate.search.default.indexBase"]; 
    var fi = new FileInfo(property); 
    return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fi.Name); 
} 
にメソッドGetIndexDirectoryを変更する必要があります
0
NHibernateSession.AddConfiguration 

動作しないのだろうか?

関連する問題