/// <summary> /// Configure NHibernate. This method returns an ISessionFactory instance that is /// populated with mappings created by Fluent NHibernate. /// /// Line 1: Begin configuration /// 2+3: Configure the database being used (SQLite file db) /// 4+5: Specify what mappings are going to be used (Automappings from the CreateAutomappings method) /// 6: Expose the underlying configuration instance to the BuildSchema method, /// this creates the database. /// 7: Finally, build the session factory. /// </summary> /// <returns></returns> private ISessionFactory CreateSessionFactory() { lock (SyncFactory) { if (_sessionFactory == null) { _sessionFactory = FluentConfig.BuildSessionFactory(); } } return(_sessionFactory); }