|
From: <fab...@us...> - 2010-08-01 19:49:18
|
Revision: 5090
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5090&view=rev
Author: fabiomaulo
Date: 2010-08-01 19:49:12 +0000 (Sun, 01 Aug 2010)
Log Message:
-----------
Removed obsolete classes (thanks to Patrick Earl)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/NHibernate.csproj
Removed Paths:
-------------
trunk/nhibernate/src/NHibernate/Impl/DbCommandSet.cs
trunk/nhibernate/src/NHibernate/Impl/IDbCommandSet.cs
trunk/nhibernate/src/NHibernate/Impl/OracleClientCommandSet.cs
trunk/nhibernate/src/NHibernate/Impl/SqlClientCommandSet.cs
Deleted: trunk/nhibernate/src/NHibernate/Impl/DbCommandSet.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Impl/DbCommandSet.cs 2010-08-01 17:41:53 UTC (rev 5089)
+++ trunk/nhibernate/src/NHibernate/Impl/DbCommandSet.cs 2010-08-01 19:49:12 UTC (rev 5090)
@@ -1,133 +0,0 @@
-
-using System;
-using System.Data;
-
-namespace NHibernate.Impl
-{
- /// <summary>
- /// Expose the batch functionality in ADO.Net 2.0
- /// Microsoft in its wisdom decided to make my life hard and mark it internal.
- /// Through the use of Reflection and some delegates magic, I opened up the functionality.
- ///
- /// Observable performance benefits are 50%+ when used, so it is really worth it.
- /// </summary>
- public abstract class DbCommandSet<TConnection, TCommand> : IDbCommandSet
- where TConnection : class, IDbConnection
- where TCommand : class, IDbCommand
- {
- private readonly PropGetter<TCommand> commandGetter;
- private readonly AppendCommand doAppend;
- private readonly ExecuteNonQueryCommand doExecuteNonQuery;
- private readonly DisposeCommand doDispose;
- private int countOfCommands;
-
- protected DbCommandSet()
- {
- object internalCommandSet = CreateInternalCommandSet();
- commandGetter =
- (PropGetter<TCommand>)
- Delegate.CreateDelegate(typeof(PropGetter<TCommand>), internalCommandSet,
- "get_BatchCommand");
- doAppend = (AppendCommand)Delegate.CreateDelegate(typeof(AppendCommand), internalCommandSet, "Append");
- doExecuteNonQuery = (ExecuteNonQueryCommand)
- Delegate.CreateDelegate(typeof(ExecuteNonQueryCommand),
- internalCommandSet, "ExecuteNonQuery");
- doDispose = (DisposeCommand)Delegate.CreateDelegate(typeof(DisposeCommand), internalCommandSet, "Dispose");
- }
-
- protected abstract object CreateInternalCommandSet();
-
- /// <summary>
- /// Append a command to the batch
- /// </summary>
- /// <param name="command"></param>
- public void Append(IDbCommand command)
- {
- AssertHasParameters(command);
- TCommand sqlCommand = (TCommand)command;
- doAppend(sqlCommand);
- countOfCommands++;
- }
-
- /// <summary>
- /// This is required because SqlClient.SqlCommandSet will throw if
- /// the command has no parameters.
- /// </summary>
- /// <param name="command"></param>
- private static void AssertHasParameters(IDbCommand command)
- {
- if (command.Parameters.Count == 0)
- {
- throw new ArgumentException("A command in SqlCommandSet must have parameters. You can't pass hardcoded sql strings.");
- }
- }
-
-
- /// <summary>
- /// Return the batch command to be executed
- /// </summary>
- public IDbCommand BatchCommand
- {
- get { return commandGetter(); }
- }
-
- /// <summary>
- /// The number of commands batched in this instance
- /// </summary>
- public int CountOfCommands
- {
- get { return countOfCommands; }
- }
-
- /// <summary>
- /// Executes the batch
- /// </summary>
- /// <returns>
- /// This seems to be returning the total number of affected rows in all queries
- /// </returns>
- public int ExecuteNonQuery()
- {
- if (Connection == null)
- throw new ArgumentNullException("Connection",
- "Connection was not set! You must set the connection property before calling ExecuteNonQuery()");
- try
- {
- if (CountOfCommands == 0)
- return 0;
- return doExecuteNonQuery();
- }
- catch (Exception e)
- {
- throw new HibernateException("An exception occurred when executing batch queries", e);
- }
- }
-
- public TConnection Connection
- {
- get { return (TConnection) commandGetter().Connection; }
- set { commandGetter().Connection = value; }
- }
-
- ///<summary>
- ///Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- ///</summary>
- ///<filterpriority>2</filterpriority>
- public void Dispose()
- {
- doDispose();
- }
-
- #region Delegate Definitions
-
- private delegate T PropGetter<T>();
-
- private delegate void AppendCommand(TCommand command);
-
- private delegate int ExecuteNonQueryCommand();
-
- private delegate void DisposeCommand();
-
- #endregion
- }
-}
-
Deleted: trunk/nhibernate/src/NHibernate/Impl/IDbCommandSet.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Impl/IDbCommandSet.cs 2010-08-01 17:41:53 UTC (rev 5089)
+++ trunk/nhibernate/src/NHibernate/Impl/IDbCommandSet.cs 2010-08-01 19:49:12 UTC (rev 5090)
@@ -1,32 +0,0 @@
-using System;
-using System.Data;
-
-namespace NHibernate.Impl
-{
- internal interface IDbCommandSet : IDisposable
- {
- /// <summary>
- /// Append a command to the batch
- /// </summary>
- /// <param name="command"></param>
- void Append(IDbCommand command);
-
- /// <summary>
- /// Return the batch command to be executed
- /// </summary>
- IDbCommand BatchCommand { get; }
-
- /// <summary>
- /// The number of commands batched in this instance
- /// </summary>
- int CountOfCommands { get; }
-
- /// <summary>
- /// Executes the batch
- /// </summary>
- /// <returns>
- /// This seems to be returning the total number of affected rows in all queries
- /// </returns>
- int ExecuteNonQuery();
- }
-}
Deleted: trunk/nhibernate/src/NHibernate/Impl/OracleClientCommandSet.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Impl/OracleClientCommandSet.cs 2010-08-01 17:41:53 UTC (rev 5089)
+++ trunk/nhibernate/src/NHibernate/Impl/OracleClientCommandSet.cs 2010-08-01 19:49:12 UTC (rev 5090)
@@ -1,25 +0,0 @@
-using System;
-using System.Data.OracleClient;
-using System.Diagnostics;
-using System.Reflection;
-
-namespace NHibernate.Impl
-{
- internal class OracleClientCommandSet : DbCommandSet<OracleConnection, OracleCommand>
- {
- private static readonly System.Type oracleCmdSetType;
-
- static OracleClientCommandSet()
- {
- Assembly sysDataOracleClient =
- Assembly.Load("System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
- oracleCmdSetType = sysDataOracleClient.GetType("System.Data.OracleClient.OracleCommandSet");
- Debug.Assert(oracleCmdSetType != null, "Could not find OracleCommandSet!");
- }
-
- protected override object CreateInternalCommandSet()
- {
- return Activator.CreateInstance(oracleCmdSetType, true);
- }
- }
-}
\ No newline at end of file
Deleted: trunk/nhibernate/src/NHibernate/Impl/SqlClientCommandSet.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Impl/SqlClientCommandSet.cs 2010-08-01 17:41:53 UTC (rev 5089)
+++ trunk/nhibernate/src/NHibernate/Impl/SqlClientCommandSet.cs 2010-08-01 19:49:12 UTC (rev 5090)
@@ -1,33 +0,0 @@
-using System;
-using System.Data;
-using System.Data.SqlClient;
-using System.Reflection;
-
-namespace NHibernate.Impl
-{
- internal class SqlClientCommandSet : DbCommandSet<SqlConnection, System.Data.SqlClient.SqlCommand>
- {
- private static readonly System.Type sqlCmdSetType;
-
- static SqlClientCommandSet()
- {
- Assembly sysData = typeof (IDbConnection).Assembly;
- sqlCmdSetType = sysData.GetType("System.Data.SqlClient.SqlCommandSet");
- }
-
- protected override object CreateInternalCommandSet()
- {
- if (sqlCmdSetType == null)
- {
- throw new HibernateException("Could not find SqlCommandSet" + Environment.NewLine
- + "If you are running on Mono, batching support isn't implemented on Mono"
- + Environment.NewLine
- + "If you are running on Microsoft .NET, this probably means that internal details"
- + Environment.NewLine
- +
- "of the BCL that we rely on to allow this have changed, this is a bug. Please inform the developers");
- }
- return Activator.CreateInstance(sqlCmdSetType, true);
- }
- }
-}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-08-01 17:41:53 UTC (rev 5089)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-08-01 19:49:12 UTC (rev 5090)
@@ -1210,17 +1210,13 @@
<Compile Include="Impl\AbstractDetachedQuery.cs" />
<Compile Include="Hql\Classic\FunctionStack.cs" />
<Compile Include="Impl\AbstractSessionImpl.cs" />
- <Compile Include="Impl\DbCommandSet.cs" />
<Compile Include="Impl\DetachedNamedQuery.cs" />
<Compile Include="Impl\DetachedQuery.cs" />
<Compile Include="IDetachedQuery.cs" />
<Compile Include="IdentityEqualityComparer.cs" />
- <Compile Include="Impl\IDbCommandSet.cs" />
<Compile Include="Impl\IDetachedQueryImplementor.cs" />
<Compile Include="Impl\MultiCriteriaImpl.cs" />
<Compile Include="Impl\MultipleQueriesCacheAssembler.cs" />
- <Compile Include="Impl\OracleClientCommandSet.cs" />
- <Compile Include="Impl\SqlClientCommandSet.cs" />
<Compile Include="Impl\StatelessSessionImpl.cs" />
<Compile Include="IMultiCriteria.cs" />
<Compile Include="Intercept\AbstractFieldInterceptor.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|