Could not compile the mapping document

Fermé
amateur_gadget Messages postés 29 Date d'inscription vendredi 1 juillet 2011 Statut Membre Dernière intervention 8 février 2012 - 2 août 2011 à 12:30
Bonjour tout le monde,
J'essaie de faire un test pour débuter avec NHibernate avec une application console sur VisualStudio 2010 mais le problème que lorsque j'essaie de compiler mon projet le débugger m'affiche l'erreur " Could not compile the mapping document: RestaurationTest.DbUser.hbm.xml" Voiçi mes codes pour voir s'il y des erreurs quelque part :
App.config :
<?xml version="1.0" encoding="utf-8" ?>

<configuration>

  <configSections>
    <section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
  </configSections>

  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
      <property name="connection.connection_string">Data Source=HAMDI-PC\HAMDI;Initial Catalog=master;Integrated Security=True; User ID=sa;Password=hamdi;</property>
      <property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
      <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>



      <property name="show_sql">true</property>
      <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>

      <mapping assembly="RestaurationTest"/>
    </session-factory>

  </hibernate-configuration>

</configuration>

DbUser.hbm.xml :
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"           namespace="RestaurationTest"
                   assembly="RestaurationTest">

  <class name="DBUSER" table="DbUser" lazy="false">

    <id name="IDUSER" column="IdUser" >
      <generator class="identity"/>
    </id>

   
    <property name="LOGIN">
      <column name="Login"/>
    </property>


    <property name="PASSWORD">
      <column name="Password"/>
    </property>

    <property name="USERDATA">
      <column name="UserData"/>
    </property>
  </class>

</hibernate-mapping>

NhibernateSession.cs :
using System.Reflection;

using NHibernate;

using NHibernate.Cfg;

namespace TestHibernate
{

    public sealed class NHibernateHelper
    {

        private static ISessionFactory SessionFactory;

        private static void OpenSession()
        {

            Configuration configuration = new Configuration();
            configuration.AddAssembly(Assembly.GetCallingAssembly());
            SessionFactory = configuration.BuildSessionFactory();

        }
        public static ISession GetCurrentSession()
        {

            //if (SessionFactory == null)

            NHibernateHelper.OpenSession();
            return SessionFactory.OpenSession();

        }

        public static void CloseSessionFactory()
        {

            if (SessionFactory != null)

                SessionFactory.Close();
        }
    }
}

Program.cs :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using TestHibernate;
using HibernateLib;

namespace RestaurationTest
{
    class Program
    {
        static void Main(string[] args)
        {
            ISession session = NHibernateHelper.GetCurrentSession();
            IQuery query = session.CreateQuery("FROM DbUser ");



            IList<DbUser> R = query.List<DbUser>();


            Console.WriteLine("RES" + R[0].Login + "trouvée");

            session.Close();
            Console.Read();
        }
    }
}

NB : J'ai mis BuildAction pour DbUser.hbm.xml à Embedded Resource et la source de l'erreur est souligné au dessus Merci pour votre aide :)