NHibernate.Cfg.Configuration configuration = new NHibernate.Cfg.Configuration(); configuration.Configure(); ISessionFactory sessionFactory = configuration.BuildSessionFactory(); ISession session = sessionFactory.CreateSession();
var sessionBuilder = new SessionBuilder(); sessionBuilder.Configure(appSettings["ConnectionString"]); var session = sessionBuilder.CreateSession();In this example, we use a custom SessionBuilder class to configure the session factory with a connection string from the app settings. Then we use the CreateSession method to create a session. It is difficult to determine the package library without more information about the classes used in the code examples. However, NHibernate is a popular library for working with databases in C#.