I really don't like to post such questions like this, trying to look for an error where probably I'm missing something really simple, but I just started learning NHibernate and I'm struggled analysing this for a day now and couldn't find the problem.
My domain class:
namespace PanoMeasurer.Core.Domain
{
public class Panorama : EntityBase
{
public virtual double HeadingBase
{
get;
set;
}
}
}
namespace PanoMeasurer.Core.Domain
{
public class EntityBase : IEntity
{
public virtual Guid OID
{
get;
set;
}
}
}
My Panorama.hbm.xml mapping file:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="PanoMeasurer.Core.Domain"
namespace="PanoMeasurer.Core.Domain">
<class name="Panorama">
<id name="OID" generator="guid.comb"/>
<property name="HeadingBase"/>
</class>
</hibernate-mapping>
And the code I'm calling in a unit test:
m_config = new Configuration()
.SetProperty(Environment.ReleaseConnections, "on_close")
.SetProperty(Environment.Dialect, typeof(SQLiteDialect).AssemblyQualifiedName)
.SetProperty(Environment.ConnectionDriver, typeof(SQLite20Driver).AssemblyQualifiedName)
.SetProperty(Environment.ConnectionString, "data source =:memory: ")
.AddFile("Mappings/Xml/Panorama.hbm.xml");
m_sessionFactory = m_config.BuildSessionFactory();
Session = m_sessionFactory.OpenSession();
new SchemaExport(m_config).Execute(true, true, false, Session.Connection, Console.Out);
I'm getting an exception when creating the new configuration:
OneTimeSetUp: NHibernate.MappingException : Could not compile the mapping document: Mappings/Xml/Panorama.hbm.xml ----> System.IO.DirectoryNotFoundException : Não foi possível localizar uma parte do caminho 'C:\Users\Rodrigo\AppData\Local\JetBrains\Installations\ReSharperPlatformVs14\Mappings\Xml\Panorama.hbm.xml'. Exception doesn't have a stacktrace
It's says it cannot compile and as far as I understood it's because it couldn't find the xml file on certain path. And why is it looking for the file in the Resharper folder at all??? My projects' output are all set to the default bin/debug folder.
My solution is organized like that:
So you can see that the PanoMeasurer.Core.Domain assembly exists and the Panorama class is located in there.
And my mapping file is set to EmbededResource:
I should also tell that I'm using the lastest Nugget version of Nhibernate.
What am I missing here?