Пример #1
0
        //private DbCommand GetDbCommandByFactory()
        //{
        //    DbCommand command = DbCommandFactory.CreateDbCommand();

        //    command.CommandText = CommandText;
        //    command.CommandTimeout = TimeOut;
        //    command.CommandType = (CommandType)Enum.Parse(typeof(CommandType), CommandType.ToString());

        //    // todo: populate command
        //    if (Parameters != null && Parameters.ParameterList != null && Parameters.ParameterList.Length > 0)
        //    {
        //        foreach (DataOperationParameter param in Parameters.ParameterList)
        //        {
        //            command.Parameters.Add(param.GetDbParameter());
        //        }
        //    }

        //    return command;
        //}

        #region ICloneable Members

        public object Clone()
        {
            DataOperationCommand cmd = new DataOperationCommand();

            if (!string.IsNullOrEmpty(this.ConnectionStringName))
            {
                cmd.ConnectionStringName = this.ConnectionStringName.Clone().ToString();
            }
            cmd.CommandType = this.CommandType;
            cmd.CommandText = this.CommandText.Clone( ).ToString( );
            cmd.Name        = this.Name.Clone( ).ToString( );
            cmd.TimeOut     = this.TimeOut;
            if (this.Parameters != null)
            {
                cmd.Parameters = (DataOperationsParametersList)this.Parameters.Clone( );
            }

            return(cmd);
        }
        //private DbCommand GetDbCommandByFactory()
        //{
        //    DbCommand command = DbCommandFactory.CreateDbCommand();
            
        //    command.CommandText = CommandText;
        //    command.CommandTimeout = TimeOut;
        //    command.CommandType = (CommandType)Enum.Parse(typeof(CommandType), CommandType.ToString());

        //    // todo: populate command
        //    if (Parameters != null && Parameters.ParameterList != null && Parameters.ParameterList.Length > 0)
        //    {
        //        foreach (DataOperationParameter param in Parameters.ParameterList)
        //        {
        //            command.Parameters.Add(param.GetDbParameter());
        //        }
        //    }

        //    return command;
        //}

        #region ICloneable Members

        public object Clone()
        {
            DataOperationCommand cmd = new DataOperationCommand();
            if (!string.IsNullOrEmpty(this.ConnectionStringName))
            {
                cmd.ConnectionStringName = this.ConnectionStringName.Clone().ToString();
            }
            cmd.CommandType = this.CommandType;
            cmd.CommandText = this.CommandText.Clone( ).ToString( );
            cmd.Name = this.Name.Clone( ).ToString( );
            cmd.TimeOut = this.TimeOut;
            if ( this.Parameters != null )
            {
                cmd.Parameters = (DataOperationsParametersList)this.Parameters.Clone( );
            }

            return cmd;
        }