very strange :s

here is my config builder:

<code>

public class FluentNHibernateConfigurationBuilder : IConfigurationBuilder
   {
       #region IConfigurationBuilder Members

       public Configuration GetConfiguration(IConfiguration
facilityConfiguration)
       {
           var defaultConfigurationBuilder = new DefaultConfigurationBuilder();
           Configuration configuration =
defaultConfigurationBuilder.GetConfiguration(facilityConfiguration);

           var models = new PersistenceModel();
           models.AddMappingsFromAssembly(typeof(Provider).Assembly);
           models.AddMappingsFromAssembly(typeof(Report).Assembly);
           models.Conventions.Add(typeof(ForeignKeyConventionOverride));
           models.Configure(configuration);

           if (AppSettings.GetConfigurationBoolean("RebuildDb", false))
           {
               var export = new SchemaExport(configuration);
               var sb = new StringBuilder();
               TextWriter output = new StringWriter(sb);
               export.Drop(true, true);
               export.Execute(true, false, false, null, output);
               export.Create(true, true);
           }

           return configuration;
       }

       #endregion
   }

</code>

any help?

obv the classes Provider and Report come from 2 seperate assemblies
and this config builder lives inside my web project which has
references to both.

w://

On Fri, Oct 16, 2009 at 11:08 PM, Valeriu Caraulean <[email protected]> wrote:
>
> The config looks ok.
> Are you sure your code is correct?
>
> On Fri, Oct 16, 2009 at 10:06 PM, Wayne Douglas <[email protected]> wrote:
>>
>> so... still not got this working :(
>>
>> here is the actual config i'm using:
>>
>> <code>
>>
>> <castle>
>>  <components>
>>   <component id="GenericRepository" type="Ideal.Web.Repository`1, 
>> Ideal.Web"/>
>>  </components>
>>  <facilities>
>>   <facility id="nhibernate"
>>             isWeb="true"
>>             type="Castle.Facilities.NHibernateIntegration.NHibernateFacility,
>>  Castle.Facilities.NHibernateIntegration"
>>             
>> configurationBuilder="Ideal.Rttm.Web.FluentNHibernateConfigurationBuilder,
>> Ideal.Rttm.Web">
>>
>>     <factory id="nhibernate.factory.session1">
>>       <settings>
>>         <item key="show_sql">true</item>
>>         <item key="connection.provider">
>>           NHibernate.Connection.DriverConnectionProvider
>>         </item>
>>         <item key="connection.driver_class">
>>           NHibernate.Driver.SqlClientDriver
>>         </item>
>>         <item key="connection.connection_string">
>>           Data Source=.;Initial Catalog=Reporting1;User Id=sa;Password=xxx;
>>         </item>
>>         <item key="dialect">
>>           NHibernate.Dialect.MsSql2005Dialect
>>         </item>
>>         <item key="proxyfactory.factory_class">
>>           NHibernate.ByteCode.Castle.ProxyFactoryFactory,
>> NHibernate.ByteCode.Castle
>>         </item>
>>       </settings>
>>       <assemblies>
>>         <assembly>Ideal.Rttm.Model</assembly>
>>       </assemblies>
>>     </factory>
>>
>>     <factory id="nhibernate.factory.session2" alias="reporting">
>>       <settings>
>>         <item key="show_sql">true</item>
>>         <item key="connection.provider">
>>           NHibernate.Connection.DriverConnectionProvider
>>         </item>
>>         <item key="connection.driver_class">
>>           NHibernate.Driver.SqlClientDriver
>>         </item>
>>         <item key="connection.connection_string">
>>           Data Source=.;Initial Catalog=Reporting2;User Id=sa;Password=xxx;
>>         </item>
>>         <item key="dialect">
>>           NHibernate.Dialect.MsSql2005Dialect
>>         </item>
>>         <item key="proxyfactory.factory_class">
>>           NHibernate.ByteCode.Castle.ProxyFactoryFactory,
>> NHibernate.ByteCode.Castle
>>         </item>
>>       </settings>
>>       <assemblies>
>>         <assembly>Ideal.Reporting.Model</assembly>
>>       </assemblies>
>>     </factory>
>>
>>   </facility>
>>   <facility id="atm"
>> type="Castle.Facilities.AutomaticTransactionManagement.TransactionFacility,
>> Castle.Facilities.AutomaticTransactionManagement" />
>>  </facilities>
>> </castle>
>>
>> </code>
>>
>> has anyone used the nh facility to do this?
>>
>> On Thu, Oct 15, 2009 at 3:48 PM, Valeriu Caraulean <[email protected]> 
>> wrote:
>>>
>>> Different connection strings?
>>> I mean, are they different?
>>>
>>> On Thu, Oct 15, 2009 at 11:49 AM, Wayne Douglas <[email protected]> 
>>> wrote:
>>>>
>>>> Hi
>>>>
>>>> I'm using the nh facility to configure the following setup:
>>>>
>>>> i have 1 database which stores generic report configuration.
>>>> and another which stores the actual report data.
>>>>
>>>> i also have 1 project for interacting with the report configuration
>>>> database (entities and mappings etc)
>>>> and another for interacting with the report data database  (entities
>>>> and mappings etc).
>>>>
>>>> i've used the following to create 2 factories:
>>>>
>>>> <code>
>>>>
>>>> <facilities>
>>>>  <facility id="nhibernate">
>>>>    <factory id="nhibernate.factory.session1">
>>>>      ...
>>>>      <assemblies>
>>>>        <assembly>ReportData.Model</assembly>
>>>>      </assemblies>
>>>>    </factory>
>>>>
>>>>    <factory id="nhibernate.factory.session2" alias="reporting">
>>>>      ...
>>>>      <assemblies>
>>>>        <assembly>Reporting.Model</assembly>
>>>>      </assemblies>
>>>>    </factory>
>>>>  </facility>
>>>> </facilities>
>>>>
>>>> <code>
>>>>
>>>> the problem is is that even though nhibernate.factory.session1 and
>>>> nhibernate.factory.session2 are looking at different databases and
>>>> have different assemblies configured it always seems to create the
>>>> tables for both models in both DBs?
>>>>
>>>> how do i tell nhibernate.factory.session1 to look at db1 and model1
>>>> and nhibernate.factory.session2 to look at db2 and model2?
>>>>
>>>>
>>>> --
>>>> Cheers,
>>>>
>>>> w://
>>>>
>>>> >
>>>>
>>>
>>> >
>>>
>>>
>>
>>
>>
>> --
>> Cheers,
>>
>> w://
>>
>> >
>>
>
> >
>
>



-- 
Cheers,

w://

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to