Dave,

 

Well, actually it seems to work. I made use of a property to limit the number 
of nodes to update.

I only need to update the property (containing the root path) that will be used 
by all other paths to files (sqlmap.config, maps, etc) and the 

Resource attribute of the: 'providers' node (because it is parsed before that 
the property value is available).

Another strange behaviour: 

If you don't want to use an external file for properties you can set a custom 
property directly in the dao.config but only inside a context node (even if the 
xsd schema will warn you that is wrong).

The strange thing is that a property defined in a context node is visible to 
the other context nodes too.

That's it.

It works but I had to resign using ConfigureAndWatch because the overload 
accepting XmlDocument exists (obviously) only for the Configure method.

 

Thanks again,

 

Matteo

 

________________________________

Da: Dave Curylo [mailto:dacur...@gmail.com] Per conto di Dave Curylo
Inviato: mercoledì 17 marzo 2010 15.59
A: user-cs@ibatis.apache.org
Oggetto: Re: R: R: How to specify a different path for providers.config

 

Matteo,

 

You're welcome.  Please let me know how it works out.

 

Dave

 

On Mar 17, 2010, at 10:43 AM, Tontini Matteo wrote:





Hi Dave,

 

shame on me for not having thought about this workaround! Thank you very much 
for the good idea.

I will try it and let you know if it works for me.

Hoping for a smarter api in the next releases of Ibatis.net I will go with this.

Thank you very much for your help,

 

Matteo

 

________________________________

Da: Dave Curylo [mailto:dacur...@gmail.com] Per conto di Dave Curylo
Inviato: mercoledì 17 marzo 2010 15.28
A: user-cs@ibatis.apache.org
Oggetto: Re: R: How to specify a different path for providers.config

 

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.

 

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