nHibernate 3.2 database config in code?
Asked Answered
M

2

5

NHibernate seems to have some new ways to map entities in code, which is really nice, but I can't find any information about configuring the database connections in code. It has been a while since I used NHibernate (version 2) and I am used to Fluent NHibernate which provides this capability. Is there a similar feature built into NHibernate 3.2 and if so, how do I use it?

Matejka answered 28/11, 2011 at 20:30 Comment(0)
B
4

I believe the newer alternative to Fluent NHibernate available in version 3.2 has been dubbed the 'Loquacious API'. See this question here and the nhibernate forge wiki here for examples on how to use it.

Bosworth answered 28/11, 2011 at 20:38 Comment(2)
hmmm? which one of those mention 'loquacious' database connections?Matejka
Check out James Kovacs' blog codebetter.com/jameskovacs/2011/01/21/…Consequent
P
4

You didn't say exactly what you want to configure, but this might get you started. Explore with intellisense to see more options.

var config = new Configuration()
            .Proxy(p => p.ProxyFactoryFactory<NHibernate.Bytecode.DefaultProxyFactoryFactory>())
            .DataBaseIntegration(d =>
                                     {
                                         d.ConnectionString = "foo";
                                         d.Dialect<SQLiteDialect>();
                                     });
Paste answered 3/12, 2011 at 0:47 Comment(1)
My code shows how the set the ConnectionString and Dialect. What else do you need to configure?Paste

© 2022 - 2024 — McMap. All rights reserved.