only for schema actions you can use directly the NH's config file (setting
the property hbm2ddl.auto) and NH will do what you have configured in the
rigth moment.
http://fabiomaulo.blogspot.com/2009/06/auto-quote-tablecolumn-names.html

<http://fabiomaulo.blogspot.com/2009/06/auto-quote-tablecolumn-names.html>

2009/11/21 epitka <[email protected]>

> Ok, if anybody happens to use NHibernate with StructureMap and
> FluentNHibernate here is how I did it:
>
>
> http://stackoverflow.com/questions/1774145/nhibernate-configuration-reference-at-runtime/1775290#1775290
>
> On Nov 21, 4:31 am, epitka <[email protected]> wrote:
> > I use StructureMap with FluentNHibernate to set it up. Thought I could
> > get it from SessionFactory without having to re-write it so that I
> > hold on to reference to the Configuration in container.
> >
> >             ForRequestedType<ISessionFactory>()
> >                 .CacheBy(InstanceScope.Singleton)
> >                 .AddInstances(x => x.ConstructedBy(() =>
> >                               //
> > ObjectFactory.GetInstance<FluentConfiguration>()
> >                              Fluently.Configure()
> >                                     .Database
> > (MsSqlConfiguration.MsSql2005
> >                                         .AdoNetBatchSize(10)
> >                                         .Driver
> > ("NHibernate.Driver.SqlClientDriver")
> >                                         .ProxyFactoryFactory
> > ("NHibernate.ByteCode.Castle.ProxyFactoryFactory,
> > NHibernate.ByteCode.Castle")
> >                                         .UseOuterJoin()
> >                                         .ConnectionString(@"Server=.
> > \SQLEXPRESS;User Id=epitka;Password=password;Database=dnn49;")
> >                                         .ShowSql()
> >                                         .CurrentSessionContext
> > ("thread_static")) // CHANGE THIS FOR WEB
> >                                     .Mappings(m =>
> > m.FluentMappings.AddFromAssemblyOf<MetaProject>())
> >                                     .ExposeConfiguration(
> >                                                        cfg =>{
> >
> > cfg.SetProperty(
> >
> > Environment.TransactionStrategy,
> >
> > typeof (AdoNetTransactionFactory).FullName);
> >
> > cfg.SetProperty(Environment.GenerateStatistics, "true");  //REMOVE FOR
> > LIVE
> >                                                        })
> >
> >                                     .BuildSessionFactory())
> >                                     .WithName
> > ("SharpMod_SessionFactory"));
> >
> > On Nov 20, 8:20 pm, Fabio Maulo <[email protected]> wrote:
> >
> >
> >
> > > curiosity:
> > > how you have the sessionFactory ?
> >
> > > 2009/11/20 epitka <[email protected]>
> >
> > > > I need to get reference to Configuration to run ExportSchema. Is it
> > > > possible to get it from SessionFactory?
> >
> > > > --
> >
> > > > You received this message because you are subscribed to the Google
> Groups
> > > > "nhusers" group.
> > > > To post to this group, send email to [email protected].
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<nhusers%[email protected]>
> <nhusers%[email protected]<nhusers%[email protected]>>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/nhusers?hl=.
> >
> > > --
> > > Fabio Maulo
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=.
>
>
>


-- 
Fabio Maulo

--

You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=.


Reply via email to