首页新闻招聘找找看知识库
  • 异常:<session-factory xmlns='urn:nhibernate-configuration-2.2'> element was not found in the configuration file

     1 Configuration config = new Configuration();
     2 config.Configure();//异常位置(行号19)
     3 
     4 ISessionFactory sessionFactory = config.BuildSessionFactory();
     5 ISession session = sessionFactory.OpenSession();
     6 Person p = new Person("张三", 23);
     7 p.Id = Guid.NewGuid().ToString();
     8 object obj = null;
     9 using (ITransaction trans = session.BeginTransaction())
    10 {
    11        obj = session.Save(p);
    12     trans.Commit();
    13 }
    14 
    15 Console.WriteLine(obj);
    16 Console.ReadKey(true);

     

  • blackday
    2015-11-26 13:44 blackday
    异常信息:<session-factory xmlns='urn:nhibernate-configuration-2.2'> element was not found in the configuration file.

    NHibernate

    在 NHibernate.Cfg.ConfigurationSchema.HibernateConfiguration.Parse(XPathNavigator navigator, Boolean fromAppConfig)
    在 NHibernate.Cfg.ConfigurationSchema.HibernateConfiguration..ctor(XmlReader hbConfigurationReader, Boolean fromAppSetting)
    在 NHibernate.Cfg.Configuration.Configure(XmlReader textReader)
    在 NHibernate.Cfg.Configuration.Configure(String fileName, Boolean ignoreSessionFactoryConfig)
    在 NHibernate.Cfg.Configuration.Configure()
    在 NHibernateTest.Program.Main(String[] args) 位置 C:\Users\Administrator\Desktop\暗夜\Hibernate\NHibernate03\NHibernateTest\Program.cs:行号 19

    Void Parse(System.Xml.XPath.XPathNavigator, Boolean)
    第1楼 回到顶楼
  • blackday
    2015-11-26 16:17 blackday
    未处理的异常: NHibernate.Cfg.HibernateConfigException: <session-factory xmlns='
    urn:nhibernate-configuration-2.2'> element was not found in the configuration fi
    le.
    在 NHibernate.Cfg.ConfigurationSchema.HibernateConfiguration.Parse(XPathNavig
    ator navigator, Boolean fromAppConfig)
    在 NHibernate.Cfg.ConfigurationSchema.HibernateConfiguration..ctor(XmlReader
    hbConfigurationReader, Boolean fromAppSetting)
    在 NHibernate.Cfg.Configuration.Configure(XmlReader textReader)
    在 NHibernate.Cfg.Configuration.Configure(String fileName, Boolean ignoreSess
    ionFactoryConfig)
    在 NHibernate.Cfg.Configuration.Configure(String fileName)
    在 NHibernate.Sample.Dao.BaseOperator..ctor() 位置 C:\Users\Administrator\Des
    ktop\张平\Hibernate\NHibernate04\NHibernate.Sample.Dao\BaseOperator.cs:行号 21
    在 NHibernate.Sample.Dao.PersonDao..ctor()
    在 NHibernate.Sample.Serivce.PersonService..ctor() 位置 C:\Users\Administrato
    r\Desktop\暗夜\Hibernate\NHibernate04\NHibernate.Sample.Serivce\PersonService.cs
    :行号 12
    在 ConsoleApplication1.Program.Main(String[] args) 位置 C:\Users\Administrato
    r\Desktop\暗夜\Hibernate\NHibernate04\ConsoleApplication1\Program.cs:行号 14
    请按任意键继续. . .
    第2楼 回到顶楼
登录后才能评论,请先登录注册