Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv14225/Core
Modified Files:
AdoTemplate.cs
Log Message:
SPRNET-752 - Implement advanced DataSet related methods in AdoTemplate
Index: AdoTemplate.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core/AdoTemplate.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** AdoTemplate.cs 28 Nov 2007 05:54:47 -0000 1.6
--- AdoTemplate.cs 4 Dec 2007 06:52:19 -0000 1.7
***************
*** 2,6 ****
/*
! * Copyright © 2002-2006 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
--- 2,6 ----
/*
! * Copyright © 2002-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
***************
*** 28,36 ****
using System.Reflection;
using Common.Logging;
- using Spring.Core;
using Spring.Dao.Support;
using Spring.Data.Common;
using Spring.Data.Support;
- using Spring.Objects;
using Spring.Util;
--- 28,34 ----
***************
*** 39,68 ****
namespace Spring.Data.Core
{
-
- #region Experimental Helper Clases
- /*
- internal class ExecuteTypeDataAdapterCallback : ICommandCallback
- {
- private object adapter;
- private ITypedAdapterCallback adapterCallback;
- public ExecuteTypeDataAdapterCallback(object adapter, ITypedAdapterCallback callback)
- {
- this.adapter = adapter;
- this.adapterCallback = callback;
- }
-
- public object DoInCommand(IDbCommand command)
- {
- TypedDataSetUtils.ApplyConnectionAndTx(adapter, command);
- return adapterCallback.DoWithAdapter(adapter);
- }
- }
- */
- #endregion
-
/// <summary>
/// This is the central class in the Spring.Data namespace.
/// It simplifies the use of ADO.NET and helps to avoid commons errors.
/// </summary>
public class AdoTemplate : AdoAccessor, IAdoOperations
{
--- 37,46 ----
namespace Spring.Data.Core
{
/// <summary>
/// This is the central class in the Spring.Data namespace.
/// It simplifies the use of ADO.NET and helps to avoid commons errors.
/// </summary>
+ /// <author>Mark Pollack (.NET)</author>
+ /// <version>$Id$</version>
public class AdoTemplate : AdoAccessor, IAdoOperations
{
***************
*** 232,236 ****
}
-
/// <summary>
/// Callback to execute a IDbCommand.
--- 210,213 ----
***************
*** 238,242 ****
/// <param name="action">the callback to execute</param>
/// <returns>object returned from callback</returns>
! public Object Execute(ICommandCallback action)
{
ConnectionTxPair connectionTxPairToUse = ConnectionUtils.GetConnectionTxPair(DbProvider);
--- 215,219 ----
/// <param name="action">the callback to execute</param>
/// <returns>object returned from callback</returns>
! public object Execute(ICommandCallback action)
{
ConnectionTxPair connectionTxPairToUse = ConnectionUtils.GetConnectionTxPair(DbProvider);
***************
*** 281,287 ****
}
!
!
! public Object Execute(IDbCommandCreator commandCreator, ICommandCallback action)
{
AssertUtils.ArgumentNotNull(commandCreator, "commandCreator", "IDbCommandCreator must not be null");
--- 258,269 ----
}
! /// <summary>
! /// Executes ADO.NET operations on a command object, created by the provided IDbCommandCreator,
! /// using the interface based callback IDbCommandCallback.
! /// </summary>
! /// <param name="commandCreator">The command creator.</param>
! /// <param name="action">The callback to execute based on IDbCommand</param>
! /// <returns>A result object returned by the action or null</returns>
! public object Execute(IDbCommandCreator commandCreator, ICommandCallback action)
{
AssertUtils.ArgumentNotNull(commandCreator, "commandCreator", "IDbCommandCreator must not be null");
***************
*** 331,341 ****
}
!
public object Execute(IDataAdapterCallback dataAdapterCallback)
{
ConnectionTxPair connectionTxPairToUse = ConnectionUtils.GetConnectionTxPair(DbProvider);
-
-
-
IDbDataAdapter dataAdapter = null;
try
--- 313,327 ----
}
! /// <summary>
! /// Execute ADO.NET operations on a IDbDataAdapter object using an interface based callback.
! /// </summary>
! /// <remarks>This allows for implementing abritrary data access operations
! /// on a single DataAdapter within Spring's managed ADO.NET environment.
! /// </remarks>
! /// <param name="dataAdapterCallback">The data adapter callback.</param>
! /// <returns>A result object returned by the callback or null</returns>
public object Execute(IDataAdapterCallback dataAdapterCallback)
{
ConnectionTxPair connectionTxPairToUse = ConnectionUtils.GetConnectionTxPair(DbProvider);
IDbDataAdapter dataAdapter = null;
try
***************
*** 1321,1325 ****
ValidateUpdateWithCommandBuilderArguments(dataTable, tableMapping, selectSql);
ITableMappingCollection mappingCollection = new DataTableMappingCollection();
! mappingCollection.Add((object)tableMapping);
return (int)Execute(new DataAdapterUpdateWithCommandBuilderCallback(dataTable,
DbProvider.CreateCommandBuilder(),
--- 1307,1311 ----
ValidateUpdateWithCommandBuilderArguments(dataTable, tableMapping, selectSql);
ITableMappingCollection mappingCollection = new DataTableMappingCollection();
! mappingCollection.Add(tableMapping);
return (int)Execute(new DataAdapterUpdateWithCommandBuilderCallback(dataTable,
DbProvider.CreateCommandBuilder(),
***************
*** 1331,1349 ****
}
- public int DataTableUpdateWithCommandBuilder(DataTable dataTable,
- CommandType commandType,
- string selectSql,
- IDbParameters parameters,
- IDbDataAdapterCreator dataAdapterCreator)
- {
- throw new NotImplementedException();
- }
- public int DataTableUpdateWithCommandBuilder(DataTable dataTable,
- IDbCommandCreator selectCommandCreator,
- IDbDataAdapterCreator dataAdapterCreator)
- {
- throw new NotImplementedException();
- }
public int DataTableUpdate(DataTable dataTable,
--- 1317,1321 ----
***************
*** 1499,1508 ****
}
- public DataSet DataSetCreateWithParams(IDbDataAdapterCreator dataAdapterCreator,
- IDataSetFillLifecycleProcessor fillLifecycleProcessor)
- {
- throw new NotImplementedException();
- }
-
#endregion
--- 1471,1474 ----
***************
*** 1648,1662 ****
}
-
-
- public int DataSetFillWithParameters(DataSet dataSet,
- IDbDataAdapterCreator dataAdapterCreator,
- IDataSetFillLifecycleProcessor fillLifecycleProcessor)
- {
- throw new NotImplementedException();
- }
-
-
-
#endregion
--- 1614,1617 ----
***************
*** 1665,1669 ****
CommandType commandType,
string selectSql,
! IDbParameters parameters,
string tableName)
{
--- 1620,1624 ----
CommandType commandType,
string selectSql,
! IDbParameters selectParameters,
string tableName)
{
***************
*** 1675,1679 ****
commandType,
selectSql,
! parameters,
null));
}
--- 1630,1634 ----
commandType,
selectSql,
! selectParameters,
null));
}
***************
*** 1682,1686 ****
CommandType commandType,
string selectSql,
! IDbParameters parameters,
string tableName,
IDataAdapterSetter dataAdapterSetter)
--- 1637,1641 ----
CommandType commandType,
string selectSql,
! IDbParameters selectParameters,
string tableName,
IDataAdapterSetter dataAdapterSetter)
***************
*** 1693,1697 ****
commandType,
selectSql,
! parameters,
dataAdapterSetter));
}
--- 1648,1652 ----
commandType,
selectSql,
! selectParameters,
dataAdapterSetter));
}
***************
*** 1700,1704 ****
CommandType commandType,
string selectSql,
! IDbParameters parameters,
ITableMappingCollection mappingCollection,
IDataAdapterSetter dataAdapterSetter)
--- 1655,1659 ----
CommandType commandType,
string selectSql,
! IDbParameters selectParameters,
ITableMappingCollection mappingCollection,
IDataAdapterSetter dataAdapterSetter)
***************
*** 1710,1733 ****
commandType,
selectSql,
! parameters,
dataAdapterSetter));
}
- public int DataSetUpdateWithCommandBuilder(DataSet dataSet,
- CommandType commandType,
- string selectSql,
- IDbParameters parameters,
- IDbDataAdapterCreator dataAdapterCreator)
- {
- throw new NotImplementedException();
- }
-
- public int DataSetUpdateWithCommandBuilder(DataSet dataSet,
- IDbCommandCreator selectCommandCreator,
- IDbDataAdapterCreator dataAdapterCreator)
- {
- throw new NotImplementedException();
- }
-
public int DataSetUpdate(DataSet dataSet,
string tableName,
--- 1665,1672 ----
commandType,
selectSql,
! selectParameters,
dataAdapterSetter));
}
public int DataSetUpdate(DataSet dataSet,
string tableName,
***************
*** 2208,2211 ****
--- 2147,2152 ----
#region Private DataAdapter Helper callbacks
+
+
private class DataAdapterFillCallback : IDataAdapterCallback
{
***************
*** 3130,3132 ****
--- 3071,3074 ----
}
}
+
}
\ No newline at end of file
|