NHibernate - Fluent NHibernate Configuration for Oracle 11g

Asked By Mohan on 29-Nov-10 08:47 AM
Hi,

I was trying find articles related to fluent NHibernate for oracle 11g database, please help out in getting some sample code or full articles for the same. Every1 has used either SQlLite or MSSQL.

Thanks,
Mohan
marco nunes replied to Mohan on 01-Feb-11 09:54 AM
Hi...

Several people answer with thoose databases...

once i have the same problem here goes the solution...

*********************************************************************************************************************************

string cstring = ConfigurationManager.AppSettings["ConnectionInfo"];

FluentConfiguration config = Fluently.Configure();

#region DataBase ::: Tested and OK

config.Database(OracleDataClientConfiguration.Oracle10.ConnectionString(c => c.Is(cstring))

.Driver<NHibernate.Driver.OracleClientDriver>()

.ShowSql());

#endregion

config.Mappings(m => m.FluentMappings.AddFromAssemblyOf<[one of my entities]>());

config.BuildConfiguration();

return config.BuildSessionFactory();

******************************************************************************************

In my web.config file

<appSettings>

<add key="ConnectionInfo" value="Data Source=//[host]:[port]/[db name]; User Id=[user]; Password=[password];" />

</appSettings>

*******************************************************************************************

This is an example according to the best practices.

It's working and tested

Hope this Helps

Mohan replied to marco nunes on 03-Feb-11 10:28 AM
Hey thanks nunes,

After googling for so many days for best available options i found the same thing, just forgot to update the same into the forum...:)

I am planning to post a full fledged application which uses fluent  nhibernate, oracle 11g, ASP.NET 4.0 and a code generator to support.

Mohan.