public static NHibernateDbBuilder For(DatabaseEngine databaseEngine,
                                       DbConnectionInfo dbConnectionInfo,
                                       MappingInfo mappingInfo)
 {
     return(new NHibernateDbBuilder(DbMediaBuilder.For(databaseEngine, dbConnectionInfo),
                                    NHibernateConfigurator.Create(databaseEngine, dbConnectionInfo, mappingInfo)));
 }
        /// <summary>
        /// Create a <see cref="NHibernateDbBuilder"/> configured with the nhibernate config file supplied
        /// </summary>
        /// <remarks>
        /// <para>
        /// If a relative path is supplied, the path is considered relative to the executable file that is calling
        /// this method
        /// </para>
        /// <para>
        /// If <paramref name="filePath"/> is null or empty, then a search will be made for configuration
        /// in the following locations: <em>hibernate.config</em>, <em>hibernate.cfg.xml</em>; the first file found
        /// in the order specified will be selected
        /// </para>
        /// </remarks>
        public static NHibernateDbBuilder For(string filePath)
        {
            filePath = ConvertToAbsoluteConfigFilePath(filePath);

            Configuration cfg = new Configuration().Configure(filePath);

            DatabaseEngine?engine = cfg.GetDatabaseEngine();

            if (engine == null)
            {
                throw new InvalidOperationException(
                          string.Format("Database engine cannot be determined from the config file '{0}'", filePath));
            }

// ReSharper disable ConstantNullCoalescingCondition
            DbMediaBuilder dbMediaBuilder = DbMediaBuilder.For(engine ?? DatabaseEngine.MsSql2005,
                                                               cfg.GetDbConnectionInfo());

// ReSharper restore ConstantNullCoalescingCondition
            return(new NHibernateDbBuilder(dbMediaBuilder, new NHibernateSimpleConfigurator(cfg)));
        }