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 "Nguyen, Tom" <To...@rels.info> on 2006/05/18 23:40:46 UTC

Possible bugs in latest source from SVN

Hi,

 

Possible Bugs:

DBHelperParameterCache give me an exception if I open a Transaction.  It
said something like derived command must participate in the underline
transaction if a transaction is already open for the connection.

 

So I fix it with: (Line 59-80)
IBatisNet.Common.Utilities.DBHelperParameterCache.cs

 

// added Transaction parameter and pass it the transaction from the
session.

 

                        private static IDataParameter[]
DiscoverSpParameterSet(IDalSession session, string spName, bool
includeReturnValueParameter)

                        {

                                    return
InternalDiscoverSpParameterSet(session.DataSource.DbProvider,
session.Connection, spName, includeReturnValueParameter,
session.Transaction);        

                        }

 

                        // .. snip

                        private static IDataParameter[]
InternalDiscoverSpParameterSet(IDbProvider provider,

                                    IDbConnection connection, string
spName, bool includeReturnValueParameter, IDbTransaction transaction)

                        {

                                    using (IDbCommand cmd =
connection.CreateCommand())

                                    {

                if (transaction != null)

                    cmd.Transaction = transaction;

 

 

Also, I've implemented proxy using Aspect# and runs into an issue from
latest source in DotNetObjectDataExchange.cs line 81:

 

If (target.GetType() != _parameterClass) throw new ArgumentException....

 

Since a proxy (target) is the same type as _parameterClass - derived
from, can this be change to the code below or just commented out all
together?

 

if (target.GetType() != _parameterClass &&
!(_parameterClass.IsSubClassOf(target)) ) throw new ...

 

 

 

Feature request:

Can daoFactory have another key, a string type key?  I know, I'm too
lazy to write a new Dao Factory.  I just modified iBatis and piggyback
my key attribute, but would like this implemented as a feature so I
don't have to keep a local build ;)

 

Dao.config

 

            <daoFactory>

                  <dao key="Issue"

                        interface="Rels.ITS.DataAccessObjects.IIssueDao,
Rels.ITS.DataAccessObjects" 

 
implementation="Rels.ITS.DataAccessObjects.IssueDao,
Rels.ITS.DataAccessObjects" />

                  <dao key="IssueNote"

 
interface="Rels.ITS.DataAccessObjects.IIssueNoteDao,
Rels.ITS.DataAccessObjects" 

 
implementation="Rels.ITS.DataAccessObjects.IssueNoteDao,
Rels.ITS.DataAccessObjects" />

                  <dao key="IssueAssignLog"

 
interface="Rels.ITS.DataAccessObjects.IIssueAssignLogDao,
Rels.ITS.DataAccessObjects" 

 
implementation="Rels.ITS.DataAccessObjects.IssueAssignLogDao,
Rels.ITS.DataAccessObjects" />

            </daoFactory>

 

 

Code:

 

IssueDao idao = DaoManager.GetDao("Issue") as IssueDao;

// or the old way which will still work

IssueDao idao = DaoManager.GetDao(typeof(IIssueDao)) as IssueDao;

 

 

 

Thanks,

 

Tom Nguyen


Re: Possible bugs in latest source from SVN

Posted by Gilles Bayon <ib...@gmail.com>.
Fix applied. Thanks.
For the feature request, I don't see benefit and it's safe to get the Dao by
the type so I will not incorporated.

Cheers
-Gilles