Hnibdation error: "urn: nhibernate-mappi" is not declared

Source: Internet
Author: User

Please help me solve this problem. I just learned this HNibernate. Thank you.

This error occurs: leleapplication2.mapping. User. hbm. xml (2, 2): XML validation error: the "urn: nhibernate-mapping-2.2: nhibdation" element is not declared.

 

// Here is the Console

Class Program
  1. {
  2. Static void Main (string [] args)
  3. {
  4. Test ();
  5. }
  6. Static void Test ()
  7. {
  8. NHibernateHelper db = new NHibernateHelper ();
  9. ISession session = db. GetSession ();
  10. Using (var trans = session. BeginTransaction ())
  11. {
  12. User user = new User ();
  13. User. Age = 123;
  14. User. Name = "janekim ";
  15. Session. Save (user );
  16. Trans. Commit ();
  17. }
  18. }


// NHibernateHelper help class

Namespace ConsoleApplication2
  1. {
  2. Public class NHibernateHelper
  3. {
  4. Private ISessionFactory sessffacloud;
  5. Public NHibernateHelper ()
  6. {
  7. Sessffacloud = GetSessionFactory ();
  8. }
  9. Private ISessionFactory GetSessionFactory ()
  10. {
  11. Configuration config = new Configuration (). AddAssembly (Assembly. GetExecutingAssembly ());
  12. Return config. BuildSessionFactory ();
  13. }
  14. Public ISession GetSession ()
  15. {
  16. Return sessffacloud. OpenSession ();
  17. }
  18. }
  19. }


// Here is User. hbm. xml

<? Xml version = "1.0" encoding = "UTF-8"?>
  1. <Nhib1_xmlns = "urn: nhibernate-mapping-2.2">
  2. <Class name = "leleapplication2.domain. User, ConsoleApplication2" table = "User"> </class>
  3. <Id name = "Id" length = "4">
  4. <Generator class = "vative"> </generator>
  5. </Id>
  6. <Property name = "Name">
  7. <Column name = "Name" sqltype = "nvarchar" length = "50" not-null = "true"> </column>
  8. </Property>
  9. <Property name = "Age">
  10. <Column name = "Age" sqltype = "int" length = "4" not-null = "true"> </column>
  11. </Property>
  12. </Nhib.pdf>

// App. config configuration file

 


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.