-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Embed mapping file
PostPosted: Wed May 24, 2006 5:21 am 
Newbie

Joined: Wed May 24, 2006 5:06 am
Posts: 3
Hi all,
I've come to nHibernate from my experience with Hibernate in the Java side, but a problem has just arised at the begining.
I currently use Visual Web Developer to make an application and I have no way to set the build action for the mapping file to Embedded Resource. I have read I can work around it by adding the xml directly:

Code:
NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration();
cfg.AddXmlFile(physicalPath + "client.hbm.xml");


With this code, I get this error:

Could not load type 'NHibernateFirst.Core.Domain.Client, NHibernate, Version=1.0.2.0, Culture=neutral, PublicKeyToken=154fdcb44c4484fc', check that type and assembly names are correct

I suposse nHibernate tries to locate client class into an assembly called NHibernate (the default?). So my question is if there is any way to solve it in VWD, or how to make an assembly containing the mapping and domain classes files.

Thanks very much


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 24, 2006 11:33 pm 
Regular
Regular

Joined: Mon May 16, 2005 1:35 am
Posts: 67
It appears that NHibernate is correctly loading your mapping file. Make sure that your class names in the mapping file are fully qualified:

<class name="MyNamespace.MyClass, MyAssemblyName" ...>


Top
 Profile  
 
 Post subject: re
PostPosted: Thu May 25, 2006 3:19 am 
Newbie

Joined: Wed May 24, 2006 5:06 am
Posts: 3
Yes, I've read nHibernate needs classes to be fully qualified in the mapping file. Nevertheless, since I use Visual Web Developer I have no idea about what is the name of the resulting assembly.

Thnks very much


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 25, 2006 4:29 am 
Newbie

Joined: Wed Oct 12, 2005 10:28 pm
Posts: 10
Other solution you can build your domain object using C#/VB Express Edition and import in bin folder.

From my experiance before i'm also having the same problem when try to execute nHibernate in Visual Web Developer.


Top
 Profile  
 
 Post subject: similar experience
PostPosted: Thu May 25, 2006 11:58 am 
Beginner
Beginner

Joined: Mon May 22, 2006 12:12 am
Posts: 23
Hi Tihor,

Your problem is what I've experienced.

What I've done to create the assembly:

So, download VC#/VB express (or whatever). Build a Class Project which has the Persistent Class file as well as the hbm file. You will find an option to build as Embedded Resource on double-click the hbm file.
...include refer to NHibernate.dll and anything needed.

The project properties default Assembly name to project name and you may edit as necessary?


Build it. You have a dll file

Done. Use Visual Web Developer, add the dll file to the Bin folder and a reference will be linked to the project automatically.


ok. But I'm not done. I've hit another problem. Pls refer to my other post tonite if you want.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.