I'll try to add as much information as possible to make my problem
cleared.

This is my solution structure:
GUI - Winforms project
ApplicationServer.dll
DatabaseServer.dll
DataEntities.dll

The hbm files are stored in a directory in the DatabaseServer.dll
(Database\Mappings)
The domain classes are in the DataEntities.dll

For now I only included only one hbm file. Its build action is set to
'Embedded Resource':

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping
  assembly="DataEntities"
  namespace="Themis.DataEntities"
  xmlns="urn:nhibernate-mapping-2.2" auto-import="true">
  <class name="Project" table="PROJECTS">
    <id name="PK" column="PK" access="nosetter.camelcase">
      <generator class="native"/>
    </id>
    <property name="Name" column="NAME"/>
    <property name="Id" column="ID"/>
    <property name="Description" column="DESCRIPTION"/>
  </class>
</hibernate-mapping>

The application will use sdf files that the user can switch so all the
configuration is done through code. This code is included in
DatabaseServer.dll:
        Configuration cfg = new Configuration();

        cfg.Properties["connection.provider"] =
"NHibernate.Connection.DriverConnectionProvider";
        cfg.Properties["dialect"] = "NHibernate.Dialect.MsSqlCeDialect";
        cfg.Properties["hibernate.connection.driver_class"] =
"NHibernate.Driver.SqlServerCeDriver";
        cfg.Properties["hibernate.connection.connection_string"] =
path;

        cfg.AddAssembly(this.GetType().Assembly);
        cfg.AddXmlFile("Mappings\\Project.hbm.xml"); ->> ERROR HERE
        sessionFactory = cfg.BuildSessionFactory();

An error is thrown when the code is adding the hbm file:

NHibernate.MappingException: Could not configure datastore from file
Mappings\Project.hbm.xml ---> System.IO.DirectoryNotFoundException:
Could not find a part of the path 'D:\Documents\my documents\Visual
Studio 2010\Projects\Application\GUI\bin\Debug\Mappings
\Project.hbm.xml'.

Looking in the debug folder under the GUI project, I can see that
there is no Mapping folder in it. Why is NHIbernate looking for it.
Its supposed to be embedded in the DatabaseServer.dll.

Thanks,
Yoav

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to