var configuration = new Configuration(); configuration.AddProperties(new Dictionary{ {"hibernate.dialect", "NHibernate.Dialect.MsSql2012Dialect"}, {"hibernate.connection.provider", "NHibernate.Connection.DriverConnectionProvider"}, {"hibernate.connection.driver_class", "NHibernate.Driver.SqlClientDriver"}, {"hibernate.connection.connection_string", "Data Source=(local);Initial Catalog=myDatabase;Integrated Security=True;"} });
var properties = new DictionaryIn this example, we configure NHibernate using Fluent NHibernate and add custom properties to the configuration object via the ExposeConfiguration() method. We also specify the database using the MySQLConfiguration object. The package library for NHibernate.Cfg Configuration AddProperties is NHibernate.Cfg.{ {"hibernate.connection.driver_class", "NHibernate.Driver.MySqlDataDriver"}, {"hibernate.connection.connection_string", "Server=localhost;Database=myDatabase;Uid=myUsername;Pwd=myPassword;"} }; var configuration = Fluently.Configure() .Database(MySQLConfiguration.Standard.ConnectionString(c => c.FromConnectionStringWithKey("MyConnectionString"))) .ExposeConfiguration(cfg => cfg.AddProperties(properties)) .BuildConfiguration();