You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Chris Weisel (JIRA)" <ib...@incubator.apache.org> on 2005/07/06 22:17:13 UTC
[jira] Created: (IBATISNET-86) Make _mapper in IBatisNet.DataMapper.Mapper protected, not private
Make _mapper in IBatisNet.DataMapper.Mapper protected, not private
------------------------------------------------------------------
Key: IBATISNET-86
URL: http://issues.apache.org/jira/browse/IBATISNET-86
Project: iBatis for .NET
Type: Improvement
Versions: DataMapper 1.1, DataMapper 1.2.0, DataMapper 1.2.1
Reporter: Chris Weisel
Assigned to: Gilles Bayon
Priority: Trivial
I'm setting up IBatisNet DataMapper to use an embedded sqlmap.config, and so I can't use the provided Mapper class. The only difference between what I'm doing and the standard (and I would guess that this applies to most other users as well) is that I need to change the InitMapper() method.
protected static void InitMapper()
{
DomSqlMapBuilder builder = new DomSqlMapBuilder();
_mapper = builder.Configure("Resources.sqlmap.config, Project.Name.Persistence);
}
This is an example of the change I need to make. If the _mapper variable were protected, instead of private, I could simply extend Mapper and override InitMapper and be done with it.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (IBATISNET-86) Make _mapper in IBatisNet.DataMapper.Mapper protected, not private
Posted by "Ron Grabowski (JIRA)" <ib...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/IBATISNET-86?page=comments#action_12315184 ]
Ron Grabowski commented on IBATISNET-86:
----------------------------------------
It would be nice to be able to specify where the sqlMap.config file is located when using IBatisNet.DataMapper.Mapper.Instance(). One possible place for setting this value is from a key in <appSettings>. Having a config variable that points to another config variable is kind of lame.
The quick start guide:
http://opensource.atlassian.com/confluence/oss/display/IBATIS/Quick+Start+Guide
recommends using your own static Mapper if you need to load sqlMap.config from somewhere other than its default location. I think that's acceptable.
If _mapper were protected, it would make writing your own static Mapper class much shorter:
namespace CompanyName.Project.Persistence.DataMapper
{
public class Mapper : IBatisNet.DataMapper.Mapper
{
protected static void InitMapper()
{
DomSqlMapBuilder builder = new DomSqlMapBuilder();
_mapper = builder.Configure("App_Includes\\IBatisNet\\sqlMap.config");
}
}
}
but I don't think you could have two classes extend IBatisNet.DataMapper.Mapper pointing to two different databases. For example:
SqlMapper oracle = CompanyName.Project.Persistence.OracleDataMapper.Instance();
SqlMapper sqlServer = CompanyName.Project.Persistance.SqlServerDataMapper.Instance();
The InitMapper method of SqlServerDataMapper would never call its InitMapper becuase the static _mapper in the base class has already initalized by OracleDataMapper. I haven't tested that so I could be wrong...
FYI, the quick start guide has this code:
protected static void Configure (object obj)
{
_mapper = (SqlMapper) obj;
}
while the Mapper.cs in SVN has this:
protected static void Configure (object obj)
{
_mapper = null;
}
The Configure method is the callback method called when the config file changes. Perhaps a better name would be ConfigurationChanged or Reset.
The original NPetshop app uses the name Reset:
http://svn.apache.org/repos/asf/ibatis/trunk/cs/npetshop/NPetshop.Service/ServiceConfig.cs
> Make _mapper in IBatisNet.DataMapper.Mapper protected, not private
> ------------------------------------------------------------------
>
> Key: IBATISNET-86
> URL: http://issues.apache.org/jira/browse/IBATISNET-86
> Project: iBatis for .NET
> Type: Improvement
> Versions: DataMapper 1.1, DataMapper 1.2.0, DataMapper 1.2.1
> Reporter: Chris Weisel
> Assignee: Gilles Bayon
> Priority: Trivial
>
> I'm setting up IBatisNet DataMapper to use an embedded sqlmap.config, and so I can't use the provided Mapper class. The only difference between what I'm doing and the standard (and I would guess that this applies to most other users as well) is that I need to change the InitMapper() method.
> protected static void InitMapper()
> {
> DomSqlMapBuilder builder = new DomSqlMapBuilder();
> _mapper = builder.Configure("Resources.sqlmap.config, Project.Name.Persistence);
> }
> This is an example of the change I need to make. If the _mapper variable were protected, instead of private, I could simply extend Mapper and override InitMapper and be done with it.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (IBATISNET-86) Make _mapper in IBatisNet.DataMapper.Mapper protected, not private
Posted by "Chris Weisel (JIRA)" <ib...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/IBATISNET-86?page=comments#action_12315175 ]
Chris Weisel commented on IBATISNET-86:
---------------------------------------
I made a mistake and didn't think this through. You can't make static methods virtual (and therefore you can't override them). The InitMapper() method would have to become a class variable, which makes it a bit trickier. However, it should be possible to do anyway. I will look into it.
> Make _mapper in IBatisNet.DataMapper.Mapper protected, not private
> ------------------------------------------------------------------
>
> Key: IBATISNET-86
> URL: http://issues.apache.org/jira/browse/IBATISNET-86
> Project: iBatis for .NET
> Type: Improvement
> Versions: DataMapper 1.1, DataMapper 1.2.0, DataMapper 1.2.1
> Reporter: Chris Weisel
> Assignee: Gilles Bayon
> Priority: Trivial
>
> I'm setting up IBatisNet DataMapper to use an embedded sqlmap.config, and so I can't use the provided Mapper class. The only difference between what I'm doing and the standard (and I would guess that this applies to most other users as well) is that I need to change the InitMapper() method.
> protected static void InitMapper()
> {
> DomSqlMapBuilder builder = new DomSqlMapBuilder();
> _mapper = builder.Configure("Resources.sqlmap.config, Project.Name.Persistence);
> }
> This is an example of the change I need to make. If the _mapper variable were protected, instead of private, I could simply extend Mapper and override InitMapper and be done with it.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Closed: (IBATISNET-86) Make _mapper in IBatisNet.DataMapper.Mapper protected, not private
Posted by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/IBATISNET-86?page=all ]
Gilles Bayon closed IBATISNET-86:
---------------------------------
Resolution: Won't Fix
>It would be nice to be able to specify where the sqlMap.config file is located when using >IBatisNet.DataMapper.Mapper.Instance().
The Mapper is here to show you how to configure of IBATIS.NET in a basic use, (I don't use it, and Java version don't have it). With the DomSqlMapBuilder you have the full power at your finger and can create your own Mapper class.
>The Configure method is the callback method called when the config file changes. Perhaps >a better name would be ConfigurationChanged or Reset.
The Configure method implement a delegate (define by iBATIS). The implementation and his name is not the concern of iBATIS, you can use what you want.
> Make _mapper in IBatisNet.DataMapper.Mapper protected, not private
> ------------------------------------------------------------------
>
> Key: IBATISNET-86
> URL: http://issues.apache.org/jira/browse/IBATISNET-86
> Project: iBatis for .NET
> Type: Improvement
> Versions: DataMapper 1.1, DataMapper 1.2.0, DataMapper 1.2.1
> Reporter: Chris Weisel
> Assignee: Gilles Bayon
> Priority: Trivial
>
> I'm setting up IBatisNet DataMapper to use an embedded sqlmap.config, and so I can't use the provided Mapper class. The only difference between what I'm doing and the standard (and I would guess that this applies to most other users as well) is that I need to change the InitMapper() method.
> protected static void InitMapper()
> {
> DomSqlMapBuilder builder = new DomSqlMapBuilder();
> _mapper = builder.Configure("Resources.sqlmap.config, Project.Name.Persistence);
> }
> This is an example of the change I need to make. If the _mapper variable were protected, instead of private, I could simply extend Mapper and override InitMapper and be done with it.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira