Free NHibernate with development / testing / production databases?

I was wondering if anyone had developed an approach to using NHibernate / Fluent NHibernate with different databases depending on the application configuration (similar to Rails, test and production databases). I believe that I can work something using methods with conditional attributes, but I would be interested to hear about experience with other approaches.

+3
source share
1 answer

You can easily associate the Fluent NHibernate configuration with your application configuration, instead of directly configuring the code; which would allow you to replace your configuration files depending on your environment.

Fluently.Configure()
  .Database(
    SQLiteConfig.Standard
      .ConnnectionString(c => c.FromAppSetting("your-key")))
  .Mappings(/* mappings */)
  .BuildSessionFactory();
+7
source

Source: https://habr.com/ru/post/1708962/


All Articles