Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25689/Common
Modified Files:
DbProvider.cs MultiDelegatingDbProvider.cs
Log Message:
adding code comments...
Index: MultiDelegatingDbProvider.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common/MultiDelegatingDbProvider.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MultiDelegatingDbProvider.cs 6 Dec 2007 05:48:27 -0000 1.2
--- MultiDelegatingDbProvider.cs 7 Dec 2007 08:09:52 -0000 1.3
***************
*** 77,86 ****
if (! entry.Key.GetType().Equals(typeof(string)))
{
! throw new ArgumentException("Key identifying target IDbProvider in TargetDbProviders dictionary property is required to be of type string. Key = " + entry.Key.ToString());
}
IDbProvider targetProvider = entry.Value as IDbProvider;
if (targetProvider == null)
{
! throw new ArgumentException("Value in TargetDbProviders dictionary is not of type IDbProvider. Value = " + targetProvider.ToString());
}
}
--- 77,86 ----
if (! entry.Key.GetType().Equals(typeof(string)))
{
! throw new ArgumentException("Key identifying target IDbProvider in TargetDbProviders dictionary property is required to be of type string. Key = " + entry.Key);
}
IDbProvider targetProvider = entry.Value as IDbProvider;
if (targetProvider == null)
{
! throw new ArgumentException("Value in TargetDbProviders dictionary is not of type IDbProvider.");
}
}
***************
*** 90,93 ****
--- 90,98 ----
+ /// <summary>
+ /// Returns a new command object for executing SQL statments/Stored Procedures
+ /// against the database.
+ /// </summary>
+ /// <returns>An new <see cref="IDbCommand"/></returns>
public IDbCommand CreateCommand()
{
***************
*** 95,98 ****
--- 100,107 ----
}
+ /// <summary>
+ /// Returns a new connection object to communicate with the database.
+ /// </summary>
+ /// <returns>A new <see cref="IDbConnection"/></returns>
public IDbConnection CreateConnection()
{
***************
*** 100,103 ****
--- 109,117 ----
}
+ /// <summary>
+ /// Returns a new parameter object for binding values to parameter
+ /// placeholders in SQL statements or Stored Procedure variables.
+ /// </summary>
+ /// <returns>A new <see cref="IDbDataParameter"/></returns>
public IDbDataParameter CreateParameter()
{
***************
*** 105,108 ****
--- 119,126 ----
}
+ /// <summary>
+ /// Returns a new adapter objects for use with offline DataSets.
+ /// </summary>
+ /// <returns>A new <see cref="IDbDataAdapter"/></returns>
public IDbDataAdapter CreateDataAdapter()
{
***************
*** 110,113 ****
--- 128,138 ----
}
+ /// <summary>
+ /// Returns a new instance of the providers CommandBuilder class.
+ /// </summary>
+ /// <returns>A new Command Builder</returns>
+ /// <remarks>In .NET 1.1 there was no common base class or interface
+ /// for command builders, hence the return signature is object to
+ /// be portable (but more loosely typed) across .NET 1.1/2.0</remarks>
public object CreateCommandBuilder()
{
***************
*** 115,118 ****
--- 140,151 ----
}
+ /// <summary>
+ /// Creates the name of the parameter in the format appropriate to use inside IDbCommand.CommandText.
+ /// </summary>
+ /// <param name="name">The unformatted name of the parameter.</param>
+ /// <returns>
+ /// The parameter name formatted foran IDbCommand.CommandText.
+ /// </returns>
+ /// <remarks>In most cases this adds the parameter prefix to the name passed into this method.</remarks>
public string CreateParameterName(string name)
{
***************
*** 121,124 ****
--- 154,165 ----
+ /// <summary>
+ /// Creates the name ofthe parameter in the format appropriate for an IDataParameter, i.e. to be
+ /// part of a IDataParameterCollection.
+ /// </summary>
+ /// <param name="name">The unformatted name of the parameter.</param>
+ /// <returns>
+ /// The parameter name formatted for an IDataParameter
+ /// </returns>
public string CreateParameterNameForCollection(string name)
{
***************
*** 126,129 ****
--- 167,174 ----
}
+ /// <summary>
+ /// Return metadata information about the database provider
+ /// </summary>
+ /// <value></value>
public IDbMetadata DbMetadata
{
***************
*** 131,134 ****
--- 176,183 ----
}
+ /// <summary>
+ /// Connection string used to create connections.
+ /// </summary>
+ /// <value></value>
public string ConnectionString
{
***************
*** 137,140 ****
--- 186,194 ----
}
+ /// <summary>
+ /// Extracts the provider specific error code as a string.
+ /// </summary>
+ /// <param name="e">The data access exception.</param>
+ /// <returns>The provider specific error code</returns>
public string ExtractError(Exception e)
{
***************
*** 142,145 ****
--- 196,210 ----
}
+ /// <summary>
+ /// Determines whether the provided exception is in fact related
+ /// to database access. This can be provider dependent in .NET 1.1 since
+ /// there isn't a common base class for ADO.NET exceptions.
+ /// </summary>
+ /// <param name="e">The exception thrown when performing data access
+ /// operations.</param>
+ /// <returns>
+ /// <c>true</c> if is a valid data access exception for the specified
+ /// exception; otherwise, <c>false</c>.
+ /// </returns>
public bool IsDataAccessException(Exception e)
{
***************
*** 157,161 ****
#endif
}
!
public bool IsDataAccessExceptionBCL11(Exception e)
{
--- 222,233 ----
#endif
}
!
! /// <summary>
! /// Determines whether is data access exception in .NET 1.1 for the specified exception.
! /// </summary>
! /// <param name="e">The candidate exception.</param>
! /// <returns>
! /// <c>true</c> if is data access exception in .NET 1.1 for the specified exception; otherwise, <c>false</c>.
! /// </returns>
public bool IsDataAccessExceptionBCL11(Exception e)
{
Index: DbProvider.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common/DbProvider.cs,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** DbProvider.cs 6 Dec 2007 05:48:27 -0000 1.13
--- DbProvider.cs 7 Dec 2007 08:09:52 -0000 1.14
***************
*** 26,29 ****
--- 26,32 ----
namespace Spring.Data.Common
{
+ /// <summary>
+ /// Implemenation of of DbProvider that uses metadata to create provider specific ADO.NET objects.
+ /// </summary>
public class DbProvider : IDbProvider
{
***************
*** 39,43 ****
this.dbMetadata = dbMetadata;
}
!
public IDbCommand CreateCommand()
{
--- 42,51 ----
this.dbMetadata = dbMetadata;
}
!
! /// <summary>
! /// Returns a new command object for executing SQL statments/Stored Procedures
! /// against the database.
! /// </summary>
! /// <returns>An new <see cref="IDbCommand"/></returns>
public IDbCommand CreateCommand()
{
***************
*** 45,48 ****
--- 53,63 ----
}
+ /// <summary>
+ /// Returns a new instance of the providers CommandBuilder class.
+ /// </summary>
+ /// <returns>A new Command Builder</returns>
+ /// <remarks>In .NET 1.1 there was no common base class or interface
+ /// for command builders, hence the return signature is object to
+ /// be portable (but more loosely typed) across .NET 1.1/2.0</remarks>
public object CreateCommandBuilder()
{
***************
*** 50,53 ****
--- 65,72 ----
}
+ /// <summary>
+ /// Returns a new connection object to communicate with the database.
+ /// </summary>
+ /// <returns>A new <see cref="IDbConnection"/></returns>
public IDbConnection CreateConnection()
{
***************
*** 55,62 ****
//TODO use .NET 2.0 factory class if on 2.0
IDbConnection conn = ObjectUtils.InstantiateType(dbMetadata.ConnectionType) as IDbConnection;
! conn.ConnectionString = ConnectionString;
return conn;
}
public IDbDataAdapter CreateDataAdapter()
{
--- 74,88 ----
//TODO use .NET 2.0 factory class if on 2.0
IDbConnection conn = ObjectUtils.InstantiateType(dbMetadata.ConnectionType) as IDbConnection;
! if (conn != null)
! {
! conn.ConnectionString = ConnectionString;
! }
return conn;
}
+ /// <summary>
+ /// Returns a new adapter objects for use with offline DataSets.
+ /// </summary>
+ /// <returns>A new <see cref="IDbDataAdapter"/></returns>
public IDbDataAdapter CreateDataAdapter()
{
***************
*** 64,67 ****
--- 90,98 ----
}
+ /// <summary>
+ /// Returns a new parameter object for binding values to parameter
+ /// placeholders in SQL statements or Stored Procedure variables.
+ /// </summary>
+ /// <returns>A new <see cref="IDbDataParameter"/></returns>
public IDbDataParameter CreateParameter()
{
***************
*** 69,72 ****
--- 100,111 ----
}
+ /// <summary>
+ /// Creates the name of the parameter in the format appropriate to use inside IDbCommand.CommandText.
+ /// </summary>
+ /// <param name="name">The unformatted name of the parameter.</param>
+ /// <returns>
+ /// The parameter name formatted foran IDbCommand.CommandText.
+ /// </returns>
+ /// <remarks>In most cases this adds the parameter prefix to the name passed into this method.</remarks>
public string CreateParameterName(string name)
{
***************
*** 88,91 ****
--- 127,138 ----
}
+ /// <summary>
+ /// Creates the name ofthe parameter in the format appropriate for an IDataParameter, i.e. to be
+ /// part of a IDataParameterCollection.
+ /// </summary>
+ /// <param name="name">The unformatted name of the parameter.</param>
+ /// <returns>
+ /// The parameter name formatted for an IDataParameter
+ /// </returns>
public string CreateParameterNameForCollection(string name)
{
***************
*** 107,110 ****
--- 154,161 ----
}
+ /// <summary>
+ /// Return metadata information about the database provider
+ /// </summary>
+ /// <value></value>
public IDbMetadata DbMetadata
{
***************
*** 112,115 ****
--- 163,170 ----
}
+ /// <summary>
+ /// Connection string used to create connections.
+ /// </summary>
+ /// <value></value>
public string ConnectionString
{
***************
*** 118,121 ****
--- 173,181 ----
}
+ /// <summary>
+ /// Extracts the provider specific error code as a string.
+ /// </summary>
+ /// <param name="e">The data access exception.</param>
+ /// <returns>The provider specific error code</returns>
public string ExtractError(Exception e)
{
***************
*** 131,137 ****
}
-
-
public bool IsDataAccessException(Exception e)
{
--- 191,208 ----
}
+
+
+ /// <summary>
+ /// Determines whether the provided exception is in fact related
+ /// to database access. This can be provider dependent in .NET 1.1 since
+ /// there isn't a common base class for ADO.NET exceptions.
+ /// </summary>
+ /// <param name="e">The exception thrown when performing data access
+ /// operations.</param>
+ /// <returns>
+ /// <c>true</c> if is a valid data access exception for the specified
+ /// exception; otherwise, <c>false</c>.
+ /// </returns>
public bool IsDataAccessException(Exception e)
{
***************
*** 150,154 ****
#endif
}
!
private bool IsDataAccessExceptionBCL11(Exception e)
{
--- 221,232 ----
#endif
}
!
! /// <summary>
! /// Determines whether is data access exception in .NET 1.1 for the specified exception.
! /// </summary>
! /// <param name="e">The candidate exception.</param>
! /// <returns>
! /// <c>true</c> if is data access exception in .NET 1.1 for the specified exception; otherwise, <c>false</c>.
! /// </returns>
private bool IsDataAccessExceptionBCL11(Exception e)
{
|