hi
i've tried to google for the contributor and didn't come up with much
- i also grepped the castle svn dir but that didn't do much either.
here's what i tried:
<code file='castle.config'>
<components>
<component id="ReportingIdealConfigurationContributor"
type="Ideal.Reporting.Domain.IdealConfigurationContributor,
Ideal.Reporting.Domain"/>
<component id="RttmIdealConfigurationContributor"
type="Ideal.Rttm.Domain.IdealConfigurationContributor,
Ideal.Rttm.Domain"/>
</components>
<facilities>
<facility id="nhibernatefaciltity"
isWeb="true"
type="Castle.Facilities.NHibernateIntegration.NHibernateFacility,
Castle.Facilities.NHibernateIntegration"
configurationBuilder="Ideal.Rttm.Web.FluentNHibernateConfigurationBuilder,
Ideal.Rttm.Web">
<factory id="sessionFactory1">
<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;Integrated Security=SSPI;</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>
<!--<contributors>
<contributor key="ReportingIdealConfigurationContributor"/>
</contributors>-->
</factory>
<factory id="sessionFactory2" alias="rttm">
<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=reporting3;Integrated Security=SSPI;</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>
<!--<contributors>
<contributor key="RttmIdealConfigurationContributor"/>
</contributors>-->
</facility>
</code>
and an example contributor:
<code>
public class IdealConfigurationContributor :
IConfigurationContributor
{
public void Process(string name, Configuration config)
{
var models = new PersistenceModel();
models.AddMappingsFromAssembly(typeof(Provider).Assembly);
models.Conventions.Add(typeof
(ForeignKeyConventionOverride));
models.Configure(config);
if (AppSettings.GetConfigurationBoolean("RebuildDb",
false))
{
var export = new SchemaExport(config);
var sb = new StringBuilder();
TextWriter output = new StringWriter(sb);
export.Drop(true, true);
export.Execute(true, false, false, null, output);
export.Create(true, true);
}
}
}
</code>
i did find a conversation discussing the creation of the contributor -
which hinted at registering them and then associating them via the
following:
<contributors>
<contributor key="RttmIdealConfigurationContributor"/>
</contributors>
but contributors isn't an expected node name :(
can anyone shed some light on this for me?
cheers
w://
On 19 Oct, 11:40, Wayne Douglas <
wa...@codingvista.com> wrote:
> thanks for the poiinter :)
>
> how do i register more than one IConfigurationBuilder with the
> facility config tho?
>
>
>
>
>
> On Mon, Oct 19, 2009 at 11:16 AM, Valeriu Caraulean <
caraul...@gmail.com> wrote:
>
> > So, you want to use FluentNHibernate to configure factories built via
> > NHIntegration facility.
>
> > What I would try to do:
>
> > 1. Create a IConfigurationContributor for each of your domains.
> > 2. Check in contributors the name/factory-id to modify only the right
> > configuration
> > 3. Modify the configuration with FluentNHibernate.
>
> > This is just one way to achieve it.
>
> > On Mon, Oct 19, 2009 at 11:49 AM, Wayne Douglas <
wa...@codingvista.com> wrote:
>
> >> hey - cheers for looking at this with me.
>
> >> not very experienced with nhib - i thought the assembly definition in
> >> the xml would point the factory to one assembly so it would only push
> >> the resulting sql creation scripts to that one db. i thought the one
> >> in the c# was just there to bootstrap it all.
>
> >> so i need to have 2 separate config builders?
>
> >> how do i wire one up with one factory configuration and the other with
> >> the other configuration?
>