Hello,
Trying to come to grips with NHibernate, and am in need of a poke in the right direction. The NHibernateEg TutorialA compiles and runs locally without issue.
I've mapped our database using a templating tool - "MyGeneration" - with the "NHibernate OM - 0.7.1" template, all seems ok, I have double checked "Embedded Resource" flag is set on all <table>.hbm.xml files, but can't seem to get past this exception:
Quote:
NHibernate.MappingException was unhandled
Message="The element 'class' in namespace 'urn:nhibernate-mapping-2.0' has invalid child element 'property' in namespace 'urn:nhibernate-mapping-2.0'. List of possible elements expected: 'urn:nhibernate-mapping-2.0:meta urn:nhibernate-mapping-2.0:jcs-cache urn:nhibernate-mapping-2.0:cache urn:nhibernate-mapping-2.0:id urn:nhibernate-mapping-2.0:composite-id'."
Source="NHibernate"
StackTrace:
at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream)
...etc...
An example mapping file:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="InterActiveHealth.Data.Application,InterActiveHealth.Data" table="Application">
<id name="ApplicationId" column="Application_ID" type="String">
<generator class="assigned"/>
</id>
<property column="Name" type="String" name="Name" not-null="true" length="50" />
<property column="Purpose" type="String" name="Purpose" not-null="true" length="255" />
...etc...
</class>
</hibernate-mapping>
My test is just a simple console app:
Code:
using InterActiveHealth.Data;
using NHibernate;
using NHibernate.Cfg;
namespace ConsoleTest
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Starting Test");
Configuration configuration = new Configuration();
configuration.AddAssembly("InterActiveHealth.Data"); // <-- MappingException
Any clues please? It appears to be a schema issue, but how can I stuff that up when the manual says:
Quote:
All XML mappings have to use the nhibernate-mapping-2.0 schema. The actual schema may be found in the NHibernate source directory, or as an Embedded Resource in NHibernate.dll. NHibernate will always use the Embedded Resource as the source for the schema.
I'm sure it's something simple :roll:
cheers
si