I respect your ability to comment on my attitude.
I will agree-to-disagree in AddFile().  I don't think something is viable 
when it is said to work but in all reality doesn't no matter how it's use 
is attempted.
Perhaps it works in older implementations (VS2010 & .Net 2 & Web Forms) or 
maybe other platforms.
But in my case it is said to work ~ but it just plane doesn't.
Most people are using Embedded Resource ~ most likely for a reason.

But I'm done.  I can chose we use hbm - or something else.
The enormity of my and other's man-hours I'm not sure where I'll go with it.

Thanks for you help and looking into this issue with me.
Respectfully.



On Wednesday, March 2, 2016 at 12:25:59 PM UTC-5, Gunnar Liljas wrote:
>
> Just verified. If you call AddFile with a file that doesn't exist 
> (according to the environment), this is the actual exception you get, and 
> you would have seen it if you had just looked for it.
>
> NHibernate.MappingException : Could not compile the mapping document: 
> test.xml
>   ----> System.IO.FileNotFoundException : Could not find file 
> 'c:\......\test.xml'.
>
> It is NOT a bug. AddFile is a perfectly viable method to use. Of course it 
> requires that the file actually exists.
>
> "You guys need some help over there?"
>
> Always.
>
> "I'll be both honest and hard on you because I expect a lot of quality 
> because quality is a choice to apply an effort and I don't value lazy."
>
> 1. NHibernate is an open source project handled on spare time. You can 
> have expectations but you can't require those expectations to be met. 
> 2. Lazy? Really?
>
> "And if you think I'm being harsh"
>
> I think your attitude and vocabulary reduces your chance of getting help, 
> especially when you don't listen to the advice we've been trying to give. 
> Instead of saying "it's a bug!", "contrary good application management" 
> or "Shortcomings and underdevelopment ", you could have just said "Sorry, 
> I don't know how to access the real error message. Please show me how. In 
> code.". 
>
> /G
>
>
> 2016-03-02 14:29 GMT+01:00 Steve Lyle <[email protected] <javascript:>>:
>
>>
>> Gunnar!  Again, I've given you *everything *nHibernate reports on the 
>> error.  Do you need a live, real-time, firsthand demo?
>> You know this.  Like anything else nHibernate code, at execution, runs 
>> into a problem, catches it, and throws a message.
>> In this case "*NHibernate.MappingException*' with "Could not compile the 
>> mapping document".  Search the code for references to those literals in 
>> context of AddFile()
>>
>> *What it really turned out to be.*
>> AddFile() ~ can't find the file ~ no matter where I put it or what value 
>> I pass into AddFile(). ~ This by definition is a bug.  Thing I can't figure 
>> out is if it is because of IIS security.
>> This should not be true given the context of my running this in VStudio 
>> and on my local workstation AND that Configure(<file name>) does not have 
>> the same issue trying to access <file name>.
>>
>> In terms of error reporting "Could not find file" would be more clear and 
>> the code of AddFile() should be quite capable of discerning "I cannot find 
>> the file" -v- "I could not compile the file [because I can't find it]".  
>> I'll bet "could not compile" is a defacto catch all, which is never going 
>> to be of real help because there isn't any real troubleshooting depth 
>> beyond the defacto.  
>> Real help would be look like "I can't compile this file 'X' and here is 
>> why ....".
>> But this get right to the only approach, "embedded resource", being the 
>> only viable method for nHibernate to load a mapping ~ contrary to 
>> documentation.
>> Someone on here once said "embedded resource" is the common way"  ... 
>> well... I distinguish the difference between common practice be people 
>> perfer to do that -v- common practice because it is the only functional way 
>> to make it work.
>>  
>>
>> You guys need some help over there?
>> I'll be both honest and hard on you because I expect a lot of quality 
>> because quality is a choice to apply an effort and I don't value lazy.  
>> That and I like to see people strive and achieve.
>> Now that all said I love nHibernate.  I'd love to see it achieve a much 
>> greater place as the utility it is.
>> And if you think I'm being harsh ... well there is why.
>> You should here me go off at Microsoft's EF.  THAT is complete @@@ trash 
>> and should be removed from the planet.
>> EF is literally hurting people & dragging down careers.
>>
>>
>>
>>
>>
>>
>>
>> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/nhusers.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to