mrblah
mrblah

Reputation: 103507

does fluent handle the configuration also or I still need configuration.cfg.xml

I am using fluent for mappings in my web application that uses nhibernate (just setting it up!).

Do I use fluent for the database configuration file or I use fluent for that?

Upvotes: 0

Views: 66

Answers (1)

Erik Öjebo
Erik Öjebo

Reputation: 10851

Yes, you can use Fluent NHibernate for configuration as well, using what they call Fluent Configuration. You can find the documentation for Fluent Configuration here.

Here is an example of what it can look like when using Fluent NHibernate for the NHibernate configuration:

var sessionFactory = Fluently.Configure()  
  .Database(SQLiteConfiguration.Standard.InMemory)  
  .Mappings(m =>  
    m.FluentMappings  
      .AddFromAssemblyOf<YourEntity>())  
  .BuildSessionFactory();  

Upvotes: 1

Related Questions