Buenas tardes,

Estoy programando en c# con monodevelop, cada vez que trato hacer una 
consulta, me marca un excepcion no tengo idea de por donde buscar para 
corregirlo.
Me pueden dar alguna sugerencia.

*NHibernate.MappingException: Could not compile the mapping document: 
*/home/carlos/Escritorio/mono/castor/castor/Models/Mappings/Musician.hbm.xml 
---> *System.Exception: XML declaration cannot appear in this state*

*Web.config:*
  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
      <property 
name="dialect">NHibernate.Dialect.PostgreSQLDialect</property>
      <property 
name="connection.connection_string">Server=192.168.119.231;Database=test;User 
ID=castor;Password=castor;</property>
      <property name="current_session_context_class">web</property>
  <property name="show_sql">true</property>
  <mapping assembly="castor" />   
    </session-factory>
  </hibernate-configuration> 

*Musician.hbm.xml:*
<?xml version="1.0"  encoding="utf-8" ?>
<hibernate-mapping assembly="castor" namespace="castor.core" 
xmlns="urn:nhibernate-mapping-2.2">
  <class name="Musician" table="musician" lazy="true" >
    <property name="BirthYear">
      <column name="birth_year" sql-type="integer" not-null="false" />
    </property>
    <property name="MusicianName">
      <column name="musician_name" sql-type="text" not-null="false" />
    </property>
    <property name="FavoriteInstrument">
      <column name="favorite_instrument" sql-type="text" not-null="false" />
    </property>
    <id name="MusicianId">
      <generator class="identity" />
      <column name="Musician_id" sql-type="integer" not-null="true" />
    </id>
  </class>
</hibernate-mapping>

*Musician.cs:*
using System;
using System.Text;
using System.Collections.Generic;
using System.Xml;


namespace castor.core {
 public class Musician {
private int musicianId;
private int birthYear;
private string musicianName;
private string favoriteInstrument;
public Musician() { }
}
}

*NhibernateHelper.cs:*
static NHibernateHelper()
{
 // Get the mapping file path
String mappingPath = 
HttpContext.Current.Server.MapPath("/Models/Mappings/");
 // Setup the configuration
Configuration config = new Configuration()
.AddFile(mappingPath + "Musician.hbm.xml");
 // Build the session factory
sessionFactory = config.BuildSessionFactory();
}

-- 
-- 
Para escribir al Grupo, hágalo a esta dirección: 
[email protected]
Para más, visite: http://groups.google.com/group/NHibernate-Hispano
--- 
Has recibido este mensaje porque estás suscrito al grupo "NHibernate-Hispano" 
de Grupos de Google.
Para anular la suscripción a este grupo y dejar de recibir sus correos 
electrónicos, envía un correo electrónico a 
[email protected].
Para obtener más opciones, visita https://groups.google.com/groups/opt_out.


Responder a