Skip to content

Instantly share code, notes, and snippets.

@kevinpang
Created February 26, 2012 17:51
Show Gist options
  • Save kevinpang/1917946 to your computer and use it in GitHub Desktop.
Save kevinpang/1917946 to your computer and use it in GitHub Desktop.
CreateSessionFactory
public static ISessionFactory CreateSessionFactory()
{
return Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2005.ConnectionString(c => c.FromConnectionStringWithKey("InsertConnectionString")))
.Mappings(m =>
{
// Include both standard NHibernate mapping files and Fluent NHibernate mapping files
m.HbmMappings.AddFromAssemblyOf<User>();
m.FluentMappings.AddFromAssemblyOf<User>();
})
.BuildSessionFactory();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment