예제 #1
0
        /// <summary>
        /// Clones the command.
        /// </summary>
        /// <param name="command">The CMD.</param>
        /// <returns></returns>
        private static DataOperationCommand CloneCommand(DataOperationCommand cmd)
        {
            if (cmd == null)
            {
                return(null);
            }

            if (cmd is ICloneable)
            {
                return(((ICloneable)cmd).Clone() as DataOperationCommand);
            }
            else
            {
                throw new ApplicationException("A class that implements IClonable is expected.");
            }
        }
예제 #2
0
        internal DataCommand(DataOperationCommand command)
        {
            operationCommand = command;

            if (!string.IsNullOrEmpty(command.ConnectionStringName))
            {
                ConnectionStrings = GetConnectionStringByName(command.ConnectionStringName, command.DatabaseType);
            }

            supportTransaction = false;

            if (command.Parameters != null && command.Parameters.ParameterList != null &&
                command.Parameters.ParameterList.Length > 0)
            {
                dbParameters = new SqlParameter[command.Parameters.ParameterList.Length];
                for (int index = 0; index < command.Parameters.ParameterList.Length; index++)
                {
                    DataOperationParameter param = command.Parameters.ParameterList[index];
                    dbParameters[index] = (param.GetDbParameter());
                }
            }
        }
예제 #3
0
 /// <summary>
 /// Copies the command from command while keeping the dbTransaction context.
 /// </summary>
 /// <param name="command">The command.</param>
 internal void CopyCommand(DataCommand command)
 {
     operationCommand = CloneCommand(command.operationCommand);
 }