-->
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.  [ 4 posts ] 
Author Message
 Post subject: Mapping Files with ASP.NET 2.0
PostPosted: Mon Jan 30, 2006 6:42 pm 
Newbie

Joined: Mon Jan 30, 2006 6:33 pm
Posts: 9
Hi,
as there is no option in Visual Studio .NET 2005 to embedd resources NHibernate fails to load my mapping files.
NHibernate looks in the Windows\System32 directory for them. If I hard copy my mapping files to the system32 directory everything works fine.
How can I assure that my mapping files are found?
This is what I wrote in my hibernate config file:

<mapping file="Customer.hbm.xml" />
<mapping file="Order.hbm.xml" />
<mapping file="OrderPosition.hbm.xml" />

Thank you very much,
theblob


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 30, 2006 10:11 pm 
Regular
Regular

Joined: Mon May 16, 2005 1:35 am
Posts: 67
You could try putting your mapping files in the App_Code folder. There is a chance this may make ASP.NET automatically embed them. You should probably however be putting your domain objects and their associated mappings in a separate assembly. VS 2005 still allows you to embed resources in class libraries.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 31, 2006 3:43 am 
Newbie

Joined: Mon Jan 30, 2006 6:33 pm
Posts: 9
Hi,
I have tried putting them in App_Code already. But the idea with the external assembly sounds nice since I have a class project already.
I embedded my mapping files as ressource but NHibernate still can't load them.
My class-project hast the assembly name "ModelTest", my mapping files lay in a folder "Mappings" of that Class Project. In my hibernate config xml I replaced the file mappings with <mapping assembly="ModelTest">.
I read that I could just pogrammatically add the assembly with cfg.AddAssembly(..) but is this a clever way to go?
Thank you again


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 31, 2006 11:51 am 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
Put the mapping files and the *.cs files they map to in a separate project. Then point the NHibernate configuration to load that assembly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.