James, could we add an overload for the Fluently.Configure method that takes
an existing Configuration? That would probably give Mark a nicer alternative
here.

Paul

On Wed, Feb 11, 2009 at 3:58 AM, Mark Perry <[email protected]>wrote:

>
> Got it to work.
>
>        public static class NHConfigBuilder
>        {
>
>                public static void Configure()
>                {
>                        BurrowFramework bf = new BurrowFramework();
>                        IFrameworkEnvironment fe = bf.BurrowEnvironment;
>                         Configuration cfg =
> fe.GetNHConfig("PersistenceUnit1");
>                         var autoMappings = AutoPersistenceModel
>
>  .MapEntitiesFromAssemblyOf<Engineering.Domain.Model.Component>()
>                                        .WithConvention(convention =>
>                                        {
>                                        convention.IsBaseType = type => type
> == typeof
> (Engineering.Domain.Model.EngineeringBase);
>                                        })
>                                        .Where(t => t.Namespace ==
> "Engineering.Domain.Model");
>                        cfg.AddAutoMappings(autoMappings);
>                        fe.RebuildSessionFactories();
>                }
>        }
>
>
> Called in global.asax.cs on Application_Start
>
> Turns out you can't auto map the database settings with Burrow only
> inject the auto maps after Burrow has initialised.
>
> If anyone else has a neater way of doing this then please let me know.
>
> Thanks, Mark
>
> On Feb 10, 4:05 pm, Mark Perry <[email protected]> wrote:
> > Yes but I cannot see a way in which I can just get a Configuration
> > object
> > from the fluent mapping.
> >
> > I have even tried to use ExposeConfiguration to call a method
> > which grabs the configuration and uses it to assign to the
> > burrow cfg.
> >
> > Just a question but is the Nhibernate.Confguration object
> > a singleton.
> >
> > What I am thinking is that Burrow is setting the config
> > then I am setting it with FHN
> >
> > Then I am rebuilding the session factory by using the
> > fe.RebuildSessionFactories();
> >
> > Somehow though its not honouring the FNH config I just set.
> >
> > Weird and very frustrating.
> >
> > Mark
> >
> > On Feb 10, 3:53 pm, James Gregory <[email protected]> wrote:
> >
> > > So are you receiving an instance of Configuration from Burrow? Ideally
> you'd
> > > want to be able to pass that instance into the FNH config to be acted
> upon.
> >
> > > On Tue, Feb 10, 2009 at 3:51 PM, Mark Perry <
> [email protected]>wrote:
> >
> > > > Hi
> >
> > > > Just trying to get FluentNHibernate and Burrow to work together for a
> > > > web app I am working on.
> >
> > > > I can't seem to set the Nhibernate configuration that Burrow is using
> > > > or get Burrow to pick up on the
> > > > configuration set by Fluently.Configure. I know Nathan Stott managed
> > > > to get it working but I have
> > > > followed his advice and nothing is currently working for me.
> >
> > > > I can get the config from burrow by using:
> >
> > > > IFrameworkEnvironment fe = new BurrowFramework().BurrowEnvironment;
> > > > NHibernate.Cfg.Configuration cfg =
> fe.GetNHConfig("PersistenceUnit1");
> >
> > > > //Do work on the config here.
> > > > //I want to do cfg=Fluently.Configure() etc....
> > > > //But that doesn't work for me
> >
> > > > fe.RebuildSessionFactories();
> >
> > > > Can anyone help?
> >
> > > > Thanks, Mark
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to