Ich versuche derzeit, nhibernate mit MVC 3.5 zu verwenden.NHibernate [MappingException: Das Mapping-Dokument konnte nicht kompiliert werden: iMed.Models.Device.hbm.xml]
Ich habe meine nhibernate.cfg.xml in meinem Stamm zu meinem MVC-Projekt platziert. Siehe Bildschirmaufnahme des Projekts. Beide XML-Dateien sind auf Eingebettete Ressource festgelegt.
Ich habe ein DeviceRepository.cs Das hat eine Methode, die Device.cs für die Persistenz verwendet. Hier
ist die xml von nhibernate.cfg.xml
<!-- properties -->
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</property>
<property name="connection.connection_string">Server=192.168.1.5;Database=imed_development;User ID=root;Password=lights337</property>
<property name="dialect">NHibernate.Dialect.MySQL5Dialect</property>
<!-- mapping files -->
<mapping resource="iMed.Models.Device.hbm.xml" assembly="iMed" />
Hier ist die xml von Device.hbm.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="iMed.Models.Device" table="devices">
<id name="Id" column="ID" type="int">
<generator class="native"></generator>
</id>
<property name="Identifier" column="identifier" type="String"></property>
</class>
</hibernate-mapping>
ich zur Zeit bin immer ein
{"Could not compile the mapping document: iMed.Models.Device.hbm.xml"}
{"persistent class iMed.Models.Device not found"}
ich diese ziemlich neu bin, würde jeder Eingang sehr geschätzt ...
Vielen Dank im Voraus ...
Patrick