var configuration = new Configuration(); configuration.Configure(); var properties = new Dictionary{ {"connection.connection_string", "Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;"} }; configuration.AddProperties(properties); var sessionFactory = configuration.BuildSessionFactory();
var configuration = new Configuration(); configuration.SetProperty("connection.provider", "NHibernate.Connection.DriverConnectionProvider"); configuration.SetProperty("connection.driver_class", "NHibernate.Driver.SqlClientDriver"); configuration.SetProperty("connection.connection_string", "Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;"); var sessionFactory = configuration.BuildSessionFactory();In this example, the NHibernate configuration is manually created by setting the required properties for database integration. A session factory is then built from this configuration. Overall, NHibernate.Cfg Configuration DataBaseIntegration provides a flexible and customizable way to configure NHibernate for database integration in C#.