Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7705/Core
Modified Files:
AdoAccessor.cs AdoPlatformTransactionManager.cs AdoTemplate.cs
Log Message:
SPRNET-756 - Add protected method to ErrorCodeExceptionTranslator to allow for a subclass to first attempt exception translation.
Add additional code documentation
Index: AdoAccessor.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core/AdoAccessor.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AdoAccessor.cs 7 Aug 2007 23:21:53 -0000 1.2
--- AdoAccessor.cs 30 Oct 2007 15:24:44 -0000 1.3
***************
*** 37,40 ****
--- 37,42 ----
private int commandTimeout;
+ #region Properties
+
/// <summary>
/// An instance of a DbProvider implementation.
***************
*** 47,50 ****
--- 49,61 ----
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to lazily initialize the
+ /// IAdoExceptionTranslator for this accessor, on first encounter of a
+ /// exception from the data provider. Default is "true"; can be switched to
+ /// "false" for initialization on startup.
+ /// </summary>
+ /// <value><c>true</c> if to lazy initialize the IAdoExceptionTranslator;
+ /// otherwise, <c>false</c>.</value>
public abstract bool LazyInit
{
***************
*** 54,57 ****
--- 65,73 ----
+ /// <summary>
+ /// Gets or sets the exception translator. If no custom translator is provided, a default
+ /// <see cref="ErrorCodeExceptionTranslator"/> is used.
+ /// </summary>
+ /// <value>The exception translator.</value>
public abstract IAdoExceptionTranslator ExceptionTranslator
{
***************
*** 61,64 ****
--- 77,108 ----
+ /// <summary>
+ /// Gets or set the System.Type to use to create an instance of IDataReaderWrapper
+ /// for the purpose of having defaults values to use in case of DBNull values read
+ /// from IDataReader.
+ /// </summary>
+ /// <value>The type of the data reader wrapper.</value>
+ public abstract Type DataReaderWrapperType
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets the command timeout for IDbCommands that this AdoTemplate executes.
+ /// </summary>
+ /// <remarks>Default is 0, indicating to use the database provider's default.
+ /// Any timeout specified here will be overridden by the remaining
+ /// transaction timeout when executing within a transaction that has a
+ /// timeout specified at the transaction level.
+ /// </remarks>
+ /// <value>The command timeout.</value>
+ public int CommandTimeout
+ {
+ get { return commandTimeout; }
+ set { commandTimeout = value; }
+ }
+
+ #endregion
/// <summary>
***************
*** 68,74 ****
protected void ApplyCommandSettings(IDbCommand command)
{
- //TODO investigate setting of FetchSize in a portable way - used on by
- //native oracle provider.
- //TODO investigate maximum row limit settings.
ConnectionUtils.ApplyTransactionTimeout(command, DbProvider, CommandTimeout );
}
--- 112,115 ----
***************
*** 116,142 ****
public abstract void AfterPropertiesSet();
public abstract IDataReader CreateDataReaderWrapper(IDataReader readerToWrap);
- public abstract Type DataReaderWrapperType
- {
- get;
- set;
- }
-
/// <summary>
! /// Gets or sets the command timeout for IDbCommands that this AdoTemplate executes.
/// </summary>
! /// <remarks>Default is 0, indicating to use the database provider's default.
! /// Any timeout specified here will be overridden by the remaining
! /// transaction timeout when executing within a transaction that has a
! /// timeout specified at the transaction level.
! /// </remarks>
! /// <value>The command timeout.</value>
! public int CommandTimeout
! {
! get { return commandTimeout; }
! set { commandTimeout = value; }
! }
!
protected IDbParameters CreateDbParameters(string name, Enum dbType, int size, object parameterValue)
{
--- 157,178 ----
public abstract void AfterPropertiesSet();
+ /// <summary>
+ /// Creates the data reader wrapper for use in AdoTemplate callback methods.
+ /// </summary>
+ /// <param name="readerToWrap">The reader to wrap.</param>
+ /// <returns>The data reader used in AdoTemplate callbacks</returns>
public abstract IDataReader CreateDataReaderWrapper(IDataReader readerToWrap);
/// <summary>
! /// Creates the a db parameters collection, adding to the collection a parameter created from
! /// the method parameters.
/// </summary>
! /// <param name="name">The name of the parameter</param>
! /// <param name="dbType">The type of the parameter.</param>
! /// <param name="size">The size of the parameter, for use in defining lengths of string values. Use
! /// 0 if not applicable.</param>
! /// <param name="parameterValue">The parameter value.</param>
! /// <returns>A collection of db parameters with a single parameter in the collection based
! /// on the method parameters</returns>
protected IDbParameters CreateDbParameters(string name, Enum dbType, int size, object parameterValue)
{
***************
*** 149,152 ****
--- 185,192 ----
#region Parameter Creation Helper Methods
+ /// <summary>
+ /// Creates a new instance of <see cref="DbParameters"/>
+ /// </summary>
+ /// <returns>a new instance of <see cref="DbParameters"/></returns>
public virtual IDbParameters CreateDbParameters()
{
***************
*** 154,157 ****
--- 194,202 ----
}
+ /// <summary>
+ /// Derives the parameters of a stored procedure, not including the return parameter.
+ /// </summary>
+ /// <param name="procedureName">Name of the procedure.</param>
+ /// <returns>The stored procedure parameters.</returns>
public virtual IDataParameter[] DeriveParameters(string procedureName)
{
***************
*** 159,162 ****
--- 204,213 ----
}
+ /// <summary>
+ /// Derives the parameters of a stored procedure including the return parameter
+ /// </summary>
+ /// <param name="procedureName">Name of the procedure.</param>
+ /// <param name="includeReturnParameter">if set to <c>true</c> to include return parameter.</param>
+ /// <returns>The stored procedure parameters</returns>
public abstract IDataParameter[] DeriveParameters(string procedureName, bool includeReturnParameter);
Index: AdoPlatformTransactionManager.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core/AdoPlatformTransactionManager.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AdoPlatformTransactionManager.cs 9 Oct 2007 22:25:15 -0000 1.4
--- AdoPlatformTransactionManager.cs 30 Oct 2007 15:24:44 -0000 1.5
***************
*** 164,176 ****
IDbTransaction newTrans = newCon.BeginTransaction(definition.TransactionIsolationLevel);
- #region Instrumentation
-
- if (LOG.IsDebugEnabled)
- {
- LOG.Debug("Acquired Connection [ " + newCon + "] for ADO.NET transaction");
- }
-
- #endregion
-
txMgrStateObject.SetConnectionHolder(new ConnectionHolder(newCon, newTrans), true);
--- 164,167 ----
***************
*** 300,303 ****
--- 291,300 ----
}
IDbConnection con = txMgrStateObject.ConnectionHolder.Connection;
+
+ if (log.IsDebugEnabled)
+ {
+ log.Debug("Releasing ADO.NET Connection [" + con + ", " + con.ConnectionString + "] after transaction");
+ }
+
ConnectionUtils.DisposeConnection(con, DbProvider);
//TODO clear out IDbTransaction object?
Index: AdoTemplate.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core/AdoTemplate.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AdoTemplate.cs 11 Oct 2007 04:40:59 -0000 1.4
--- AdoTemplate.cs 30 Oct 2007 15:24:44 -0000 1.5
***************
*** 133,136 ****
--- 133,144 ----
}
+ /// <summary>
+ /// Gets or sets a value indicating whether to lazily initialize the
+ /// IAdoExceptionTranslator for this accessor, on first encounter of a
+ /// exception from the data provider. Default is "true"; can be switched to
+ /// "false" for initialization on startup.
+ /// </summary>
+ /// <value><c>true</c> if to lazy initialize the IAdoExceptionTranslator;
+ /// otherwise, <c>false</c>.</value>
public override bool LazyInit
{
***************
*** 139,142 ****
--- 147,155 ----
}
+ /// <summary>
+ /// Gets or sets the exception translator. If no custom translator is provided, a default
+ /// <see cref="ErrorCodeExceptionTranslator"/> is used.
+ /// </summary>
+ /// <value>The exception translator.</value>
public override IAdoExceptionTranslator ExceptionTranslator
{
***************
*** 152,155 ****
--- 165,174 ----
}
+ /// <summary>
+ /// Gets or set the System.Type to use to create an instance of IDataReaderWrapper
+ /// for the purpose of having defaults values to use in case of DBNull values read
+ /// from IDataReader.
+ /// </summary>
+ /// <value>The type of the data reader wrapper.</value>
public override Type DataReaderWrapperType
{
***************
*** 197,208 ****
}
- #region Experimental methods.
- /*
- public object ExecuteTypedAdapter(object adapter, ITypedAdapterCallback callback)
- {
- return Execute(new ExecuteTypeDataAdapterCallback(adapter, callback));
- }
- */
- #endregion
#region General Execute Callback Methods
--- 216,219 ----
***************
*** 3116,3119 ****
--- 3127,3135 ----
#endregion
+ /// <summary>
+ /// Creates the data reader wrapper for use in AdoTemplate callback methods.
+ /// </summary>
+ /// <param name="readerToWrap">The reader to wrap.</param>
+ /// <returns>The data reader used in AdoTemplate callbacks</returns>
public override IDataReader CreateDataReaderWrapper(IDataReader readerToWrap)
{
|