Oh, I think I wasn't paying attention, you need the SessionFactory.
Anyway, for an extension method using the configuration you'd do
something like:
public static FluentConfiguration BuildSessionSource(this
FluentConfiguration config)
{
return config.ExposeConfiguration(c =>
{
// your action with the config right here //
});
}
On Feb 7, 11:33 am, Nic Strong <[email protected]> wrote:
> It works OK for me too, but always looking for a way to make life easier :)
>
> Would be nice to do something like:
>
> var sessionSource = Fluently.Configure()
> .Database(SQLiteConfiguration.Standard.InMemory)
> .Mappings(m
> =>m.AutoMappings.Add(bootStrapper.AutoPersistenceModel))
> .BuildSessionSource();
>
> To create the session source as opposed to the session factory.
>
> Could do this with an extension method on FluentConfiguration but have
> no access to the configuration.
>
> On Sat, Feb 7, 2009 at 3:47 AM, Chris Marisic <[email protected]> wrote:
>
> > Using the ExposeConfiguration method looks perfectly clean to me.
>
> > On Feb 5, 7:33 pm, Nic Strong <[email protected]> wrote:
> >> I have recently switched over to using the Fluent Configuration
> >> syntax. I have been using SessionSource from
> >> FluentNHibernate.Framework when doing my tests. The constructor
> >> requires the configuration properties from the nhibernate
> >> configuration. Is there a nice way to get at this from the
> >> FluentConfiguration?
>
> >> Currently I am using a workaround saving the Configuration from
> >> ExposeConfiguration():
>
> >> [SetUp]
> >> public void SetUp()
> >> {
> >> var bootStrapper = new MediaManagerBootstrapper();
> >> Configuration config = null;
> >> var sessionFactory = Fluently.Configure()
> >> .Database(SQLiteConfiguration.Standard.InMemory)
> >> .Mappings(m =>
> >> m.AutoMappings.Add(bootStrapper.AutoPersistenceModel))
> >> .ExposeConfiguration(c => { config = c; })
> >> .BuildSessionFactory();
>
> >> Session = sessionFactory.OpenSession();
> >> var sessionSource = new SessionSource(config.Properties,
> >> bootStrapper.AutoPersistenceModel);
> >> sessionSource.BuildSchema(Session);
> >> }
>
> >> Any suggestions?
>
> >> Nic
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---