DUDE! *You the man* :-)
So for you to provide what you did (which btw confirmed so much of what I 
when through) was amazing.

You see *you* had the experience of setting up log4net in web application 
for the benefit of nHibernate.
I started down this experience without that experience to draw on and where 
I was time time and again Exception = "hibernate.dll [cannot compile 
mapping file]" & InnerExecption = null.
That was it.  Nothing more.
And when I tried to work with log4net it didn't work or provide any 
additional information.

So then what for me?  I was in a rock and a hard place.  "Please show the 
InnerException?" The innerException is NULL period.
Please use log4net.  Log4net sucks too because it doesn't work!  Darn it!!!

I only wish I could Ctrl-Z undo all the way back out to the version of the 
code that started me off on this google group days ago.
But only as of this morning I have log4net working now.  And in a couple of 
instances I can replicate the samples from your error log files.

I'll assume I had multiple typos in file-path &/ namespace &/ class &/ 
assembly ~ like a perfect storm ~ and the only error message I could 
achieve was "can't compile mapping" - PLEASE!

I don't know what the challenge is but I would like to think the top level 
exception message could be:
   "can't find your file (probably because of a typo in ...)" fix that then
   "can't find the assembly (probably because of a typo in ...)" fix that 
then
   "can't find the namespace (probably because of a typo in ...)"  and so 
on.
Why can't the most important and probably always the most frequent and 
relevant error be the first dataum presented, the outer exception message?
Maybe it is a java thing but I rarely need to go into innerexceptions 
anymore.





On Tuesday, March 1, 2016 at 5:55:02 PM UTC-5, Steve Lyle wrote:
>
> This line of code:
>             cfg.AddFile(@"C:\Users\slyle\Documents\Visual Studio 
> 2015\Projects\Cat\Cat\Models\Cat.hbm.xml");
>
> Throws this error:
>             An exception of type 'NHibernate.MappingException' occurred in 
> NHibernate.dll but was not handled in user code
>             Additional information: Could not compile the mapping 
> document: C:\Users\slyle\Documents\Visual Studio 
> 2015\Projects\Cat\Cat\Models\Cat.hbm.xml
>
> Why?
> It is as if AddFile() can't find *C:\Users\slyle\Documents\Visual Studio 
> 2015\Projects\Cat\Cat\Models\Cat.hbm.xml*
> In fact, if I intentionally inject a typo in the path to the file I get 
> the same error.
> However this line of code, immediately preceding AddFile(), doesn't have 
> any problems.
>             cfg.Configure(@"C:\Users\slyle\Documents\Visual Studio 
> 2015\Projects\Cat\Cat\Models\hibernate.cfg.xml");
> I also find if I define the configuration in Web.config then there isn't 
> any trouble.
> If I don't include the path-file literal in Configure() then the 
> hibernate.cfg.xml file will successfully be searched for and found in the 
> bin\ folder ~ kind of as a undocumented default.
> But <mapping>.hbm.xml file/s are not afforded the same bin\ folder 
> courtesy.
>
> Understand this is code from the "QuickStart" taken right off of the 
> nHibernate website
> and I have literally tried to many ways to get this to work that I'm 
> resorting to you, my 4th level of support.
>
> I understand by documentation and by construction nHibernate 
> confguration() has about 12 different ways to load mappings.
> And I'd like to believe if one works then all others will work alike. 
> Personally I believe the "Embedded Resource" option is contrary to 
> flexibility and therefore contrary good application management.
> Sadly, the "Embedded Resource" option seems to be the only way to make 
> nHibernate work.
> And worse than all this is poor error reporting.
> Shortcomings and underdevelopment all really buts enterprise adoption of 
> nHibernate into question.
> Is this thing really meant to be something - or is it only a toy?
>
> -----
> This is the mapping file:
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" 
> namespace="QuickStart" assembly="QuickStart">
>   <class name="Cat" table="Cat">
>     <!-- id name="Id"><column name="ID" sql-type="int" not-null="true" 
> /><generator class="identity" /></id -->
>     <id name="Id"><column name="CatId" sql-type="char(32)" 
> not-null="true"/><generator class="uuid.hex" /></id>
>     <property name="Name"><column name="Name" length="16" not-null="true" 
> /></property>
>     <property name="Sex" />
>     <property name="Weight" />
>   </class>
> </hibernate-mapping>
> -----
>
> -----
> This is the c# model:
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Web;
>
> namespace QuickStart
> {
>     public class Cat
>     {
>         private string id;
>         private string name;
>         private char sex;
>         private float weight;
>
>         public Cat(){}
>
>         public virtual string Id { get { return id; } set { id = value; } }
>         public virtual string Name { get { return name; } set { name = 
> value; } }
>         public virtual char Sex { get { return sex; } set { sex = value; } 
> }
>         public virtual float Weight { get { return weight; } set { weight 
> = value; } }
>     }
> }
> -----
>
>
> -----
> And this is the table DDL:
> CREATE TABLE [dbo].[Cat](
> [CatId] [char](32) NOT NULL,
> [Name] [nvarchar](16) NOT NULL,
> [Sex] [nchar](1) NULL,
> [Weight] [real] NULL,
>  CONSTRAINT [PK_Cat] PRIMARY KEY CLUSTERED 
> (
> [CatId] ASC
> )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = 
> OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
> ) ON [PRIMARY]
> -----
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nhusers+unsubscr...@googlegroups.com.
To post to this group, send email to nhusers@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to