Can someone advise me how to prevent this error. An item with the same key has already been added.?
if (sessionFactory == null)
{
Check.Require(File.Exists(sessionFactoryConfigPath),
"The config file at '" + sessionFactoryConfigPath + "' could not be found");
Configuration cfg = new Configuration();
cfg.Configure(sessionFactoryConfigPath);
var persistenceModel = new PersistenceModel();
persistenceModel.AddMappingsFromAssembly(Assembly.Load("EMedicine.Core"));
persistenceModel.Configure(cfg);
sessionFactory = cfg.BuildSessionFactory();
if (sessionFactory == null)
{
throw new InvalidOperationException("cfg.BuildSessionFactory() returned null.");
}
if (sessionFactoryConfigPath != null) sessionFactories.Add(sessionFactoryConfigPath, sessionFactory);
}
The error is here: sessionFactory = cfg.BuildSessionFactory ();
source
share