var cfg = new Configuration(); var assembly = Assembly.GetExecutingAssembly(); using (var stream = assembly.GetManifestResourceStream("MyNamespace.nhibernate.config")) { cfg.AddInputStream(stream); }
var cfg = new Configuration(); using (var stream = new FileStream(@"C:\path\to\nhibernate.config", FileMode.Open)) { cfg.AddInputStream(stream); }In this example, the NHibernate configuration is loaded from a file on the local filesystem. These examples demonstrate how to use the NHibernate.Cfg Configuration AddInputStream method to load NHibernate configurations from various sources. The NHibernate package library would likely be included as a NuGet package in your project.