有人可以告訴我如何防止此錯誤。具有相同密鑰的項目已被添加。使用同一個鍵的項目已被添加
// Failed to find a matching SessionFactory so make a new one.
if (sessionFactory == null)
{
Check.Require(File.Exists(sessionFactoryConfigPath),
"The config file at '" + sessionFactoryConfigPath + "' could not be found");
Configuration cfg = new Configuration();
cfg.Configure(sessionFactoryConfigPath);
/*MINE*/
var persistenceModel = new PersistenceModel();
persistenceModel.AddMappingsFromAssembly(Assembly.Load("EMedicine.Core"));
persistenceModel.Configure(cfg);
/*END_OF_MINE*/
// Now that we have our Configuration object, create a new SessionFactory
sessionFactory = cfg.BuildSessionFactory();
if (sessionFactory == null)
{
throw new InvalidOperationException("cfg.BuildSessionFactory() returned null.");
}
if (sessionFactoryConfigPath != null) sessionFactories.Add(sessionFactoryConfigPath, sessionFactory);
}
錯誤是在這裏: 的sessionFactory = cfg.BuildSessionFactory();
你有cfg.BuildSessionFactory()方法的來源嗎? – 2010-03-13 10:30:20
沒有對不起,我不把它 – senzacionale 2010-03-13 11:31:51