You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by "Keslar, Jeremy" <Je...@am.sony.com> on 2005/04/08 15:10:50 UTC

RE: configuration

I have made use of this hack.  Thanks Bob.

Is this something that can be included into the next version?


Jeremy

-----Original Message-----
From: Bob Hanson [mailto:mnbob70@gmail.com] 
Sent: Friday, March 18, 2005 3:09 PM
To: ibatis-user-cs@incubator.apache.org
Subject: Re: configuration

For those interested, here is the current hack I made in order to
minimize the amount of change necessary to configure the way I want.
It allowed me to put all of my configuration files in a separate
directory except providers.config which must be copied to the base
directory of every application that uses my data access layer:

In IBatisNet.Common.Utilities.Resources:
change GetConfigAsXmlDocument (line 80) from:
XmlTextReader reader = new XmlTextReader(_baseDirectory +
Path.DirectorySeparatorChar + fileName);
to:
XmlTextReader reader;
if ((fileName[1] == ':' && fileName[2] == '\\') || fileName[0] == '\\')
{ // detects paths starting with drive:, \, \\
	reader = new XmlTextReader(fileName);
}
else
{
	reader = new XmlTextReader(_baseDirectory +
Path.DirectorySeparatorChar + fileName);
}

then in all of your SqlMap.config file, make sure to use url instead
of resource for <sqlMap> and <properties>. But don't specifly a
"file://" url. Use a full path instead like:
<sqlMap url="c:\Configuration\Database\Maps\Account.xml"/>



On Fri, 18 Mar 2005 13:13:59 -0600, Bob Hanson <mn...@gmail.com>
wrote:
> ------------------------------
> 1.0.0 Alpha- 07/10/2004
> ------------------------------
> - dao.config, sqlMap.config, providers.config must be place in the
> base directory of the application domain (same dir as app.config or
> web.config)
> - removed tag 'providers' from config file.
> 
> Just wondering what the rationale for the above is? I can always
> modify the source code to meet my needs (which leads to upgrade
> headaches) but I want to understand why configuration choices aren't
> left up to the user. I'm using iBATIS for a web service and a
> (separate) web application that are being developed for production.
> iBATIS is part of my data access layer which is contained in a class
> library assembly. Coupling the configuration files with the
> apps/services somewhat defeats the purpose of my de-coupling the data
> layer.
>