Skip to content

Instantly share code, notes, and snippets.

Created February 1, 2011 23:20
Show Gist options
  • Save anonymous/806947 to your computer and use it in GitHub Desktop.
Save anonymous/806947 to your computer and use it in GitHub Desktop.
/// <summary>
/// Make the new nHibernate Manager Object
/// </summary>
public Manager()
{
// Setup Logging
log4net.Appender.FileAppender appender = new log4net.Appender.FileAppender();
appender.File = @".\logs\data-manager.log";
appender.LockingModel = new log4net.Appender.FileAppender.MinimalLock();
appender.ImmediateFlush = true;
// Logging Pattern & Layout
string pattern = "%timestamp, %thread, %level, %logger, %ndc,%message %newline";
log4net.Layout.PatternLayout pl = new log4net.Layout.PatternLayout(pattern);
appender.Layout = pl;
appender.ActivateOptions();
appender.Threshold = log4net.Core.Level.Verbose;
log4net.Config.BasicConfigurator.Configure(appender);
// Setup nHibernate Configuration
_config = new Configuration();
_config.Configure(@".\config\hibernate.cfg.xml");
if (_config == null)
{
throw new InvalidOperationException("NHibernate configuration is null.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment