-->
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.  [ 2 posts ] 
Author Message
 Post subject: 2.1. Programmatic Configuration - AddXmlFile question
PostPosted: Tue Mar 21, 2006 4:27 pm 
Newbie

Joined: Mon Feb 06, 2006 8:12 pm
Posts: 2
Hi all,

Trying to setup my Configuration but can't get it to look outside the current .exe (assembly).

In chapter 2 we see:

"2.1. Programmatic Configuration
An instance of NHibernate.Cfg.Configuration represents an entire set of mappings of an application's .NET types to a SQL database. The Configuration is used to build a (immutable) ISessionFactory. The mappings are compiled from various XML mapping files.

You may obtain a Configuration instance by instantiating it directly. Heres an example of setting up a datastore from mappings defined in two XML configuration files (in the same folder as the exe):

Configuration cfg = new Configuration()
.AddXmlFile("Item.hbm.xml")
.AddXmlFile("Bid.hbm.xml");
...
"

I tried to fully qualify the xml file by providing a hardcoded path, but it still tries to search in the current .exe path.

Does anyone know how to get .AddXmlFile() to look outside its current .exe path?

Or is this how its supposed to work (meaning i can't access an hbm.xml outside of the currently running .exe's path)?

Thanks,
Tom


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 22, 2006 7:23 am 
Beginner
Beginner

Joined: Wed Mar 22, 2006 6:59 am
Posts: 30
Hi,

You have do "say" to NHibernate config where are your mapping files...
do this before call cfg.AddXML:


Code:
cfg.AddDirectory(new System.IO.DirectoryInfo(@"c:\myproject\mappings"));


I hope this can help you


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