Skip to content

Instantly share code, notes, and snippets.

@jand187
Created January 15, 2013 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jand187/4537021 to your computer and use it in GitHub Desktop.
Save jand187/4537021 to your computer and use it in GitHub Desktop.
Basic setup for Fluent NHibernate SQL-Server
var sessionFactory = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008
.ConnectionString(@"Data Source=.\<instance>;Initial Catalog=<database>;Integrated Security=True")
.ShowSql())
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<AdjecentType>())
.ExposeConfiguration(cfg =>
{
var schemaExport = new SchemaExport(cfg);
schemaExport.Execute(true, true, false);
})
.BuildSessionFactory();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment