Matteo,

In that case, I don't think it will be as simple because like you said, the 
other files are found relative to the application's root directory rather than 
dao.config.  The only workaround I can come up with is to load your dao.config 
into an XmlDocument or XDocument object and modify the paths to these resources 
manually.  You could so something like the following:

string daoConfigPath = // Use XML API's (XmlDocument or XDocument) to get the 
path to the dao.config
string configPath = 
System.IO.Path.GetFullPath(System.IO.Path.GetDirectoryName(daoConfigPath));
// Modify the XmlDocument or XDocument in other attributes that reference 
properties.config and sqlmap.config.
// Then write the XmlDocument or XDocument to a stream that you pass to 
Configure().

Hope that is helpful.  I don't know of an easier way since all the paths are 
resolved by the application root rather than the location of dao.config.

Dave

On Mar 17, 2010, at 9:17 AM, Tontini Matteo wrote:

> Thank you for the answer but I already knew about it.
> My problem is to load sqlmap.config when referenced by dao.config, as well as 
> the providers.config when referenced by dao.config.
> Actually my question should be:
>  
> How can I specify the path to use for resolving the relative paths of the 
> files referenced by dao.config (e.g.: sqlmap.config, providers.config, 
> properties.config).
> Or
> How can I specify to resolve such paths relative to the path of dao.config 
> instead of relative to the application working directory.
>  
> However thank you very much for your kind answer,
>  
> Matteo
>  
>  
> Da: Dave Curylo [mailto:dacur...@gmail.com] Per conto di Dave Curylo
> Inviato: mercoledì 17 marzo 2010 12.49
> A: user-cs@ibatis.apache.org
> Oggetto: Re: How to specify a different path for providers.config
>  
> To specify an alternative path for sqlmap.config, you can use a similar 
> method as you did for the dao.config, calling 
> DomSqlMapBuilder.ConfigureAndWatch.  There is sample code for that here:
>  
> http://ibatis.apache.org/docs/dotnet/datamapper/ch04s04.html
>  
> I'm not sure about providers.config; I've only done this with sqlmap.config.  
> I suspect there is another similar API.
>  
> On Mar 17, 2010, at 7:26 AM, Tontini Matteo wrote:
> 
> 
> Hello,
>  
> I’ve got a .net assembly invoked as a com component from unmanaged code.
> I’m trying to explicitly specify the path to the Ibatis config file 
> (dao.config)
> Via DomDaoManagerBuilder.ConfigureAndWatch(“pathToDaoConfig”, handler)
>  
> Even if the dao.config file is found, Ibatis cannot find all the other 
> configuration files (providers.config, sqlmap.config) if they are set as 
> relative paths.
> Debugging Ibatis source code I found that, actually, all the secondary files 
> are searched relative to the working directory of the appdomain 
> (_applicationbase) instead
> of relative to the main dao.config.
> Am I right? How can I specify an alternative path for all the configuration 
> files?
>  
> Thank you very much for your efforts
>  
> Matteo Tontini
> Questo messaggio e  riservato;  il suo contenuto  non rappresenta
> in nessun caso un impegno da parte di AXA Assicurazioni, ad  
> eccezione di quanto previsto in accordi conclusi 
> per iscritto  tra voi ed  AXA Assicurazioni.
> Qualsiasi pubblicazione, utilizzo o diffusione, anche parziale di
> questo messaggio,  deve essere preventivamente  autorizzata.  Nel
> caso in cui non foste destinatari del presente messaggio,vogliate
> cortesemente avvertire immediatamente il mittente.  
>  
>  
> Ce message est confidentiel;  son contenu  ne represente en aucun
> cas un engagement de la part de AXA Assicurazioni sous reserve de 
> tout accord conclu par  ecrit entre  vous et 
> AXA  Assicurazioni.  Toute  publication, 
> utilisation  ou  diffusion,  meme partielle,  doit etre autorisee 
> prealablement.  Si vous  n' etes pas  destinataire de ce message, 
> merci d'en avertir immediatement l'expediteur.
>  
>  
> This message is  confidential; its contents  do not  constitute a 
> commitment  by  AXA Assicurazioni, except 
> where provided for  in  a written  agreement  between you and AXA 
> Assicurazioni.  Any unauthorised disclosure, 
> use or dissemination, either whole or partial,  is prohibited. If 
> you are not the intended  recipient of the message, please notify
> the sender immediately.
>  
> Questo messaggio e  riservato;  il suo contenuto  non rappresenta
> in nessun caso un impegno da parte di AXA Assicurazioni, ad  
> eccezione di quanto previsto in accordi conclusi 
> per iscritto  tra voi ed  AXA Assicurazioni.
> Qualsiasi pubblicazione, utilizzo o diffusione, anche parziale di
> questo messaggio,  deve essere preventivamente  autorizzata.  Nel
> caso in cui non foste destinatari del presente messaggio,vogliate
> cortesemente avvertire immediatamente il mittente.  
> 
> 
> Ce message est confidentiel;  son contenu  ne represente en aucun
> cas un engagement de la part de AXA Assicurazioni sous reserve de 
> tout accord conclu par  ecrit entre  vous et 
> AXA  Assicurazioni.  Toute  publication, 
> utilisation  ou  diffusion,  meme partielle,  doit etre autorisee 
> prealablement.  Si vous  n' etes pas  destinataire de ce message, 
> merci d'en avertir immediatement l'expediteur.
> 
> 
> This message is  confidential; its contents  do not  constitute a 
> commitment  by  AXA Assicurazioni, except 
> where provided for  in  a written  agreement  between you and AXA 
> Assicurazioni.  Any unauthorised disclosure, 
> use or dissemination, either whole or partial,  is prohibited. If 
> you are not the intended  recipient of the message, please notify
> the sender immediately.

Reply via email to