public override string ToString() { StringBuilder stringBuilder = new StringBuilder(this.CommandText); foreach (object obj in this.Parameters) { MonadParameter monadParameter = (MonadParameter)obj; if (monadParameter.IsSwitch) { stringBuilder.Append(" -" + monadParameter.ParameterName); } else { string text = MonadCommand.FormatParameterValue(monadParameter.Value); if (!string.IsNullOrEmpty(text)) { stringBuilder.Append(" -" + monadParameter.ParameterName + " " + text.ToString()); } else { stringBuilder.Append(" -" + monadParameter.ParameterName + " ''"); } } } return(stringBuilder.ToString()); }
private void CopyTo(MonadParameter destination) { destination.parameterName = this.parameterName; destination.value = this.value; destination.sourceColumn = this.sourceColumn; destination.sourceVersion = this.sourceVersion; destination.isNullable = this.isNullable; destination.dbType = this.dbType; destination.isSwitch = this.isSwitch; }
private MonadParameter(MonadParameter source) { source.CopyTo(this); ICloneable cloneable = this.value as ICloneable; if (cloneable != null) { this.value = cloneable.Clone(); } }
// Token: 0x060010F8 RID: 4344 RVA: 0x00033F94 File Offset: 0x00032194 public override void AddRange(Array values) { if (values == null) { throw new ArgumentNullException("values"); } foreach (object obj in values) { MonadParameter item = (MonadParameter)obj; this.InnerList.Add(item); } }
private PSCommand GetPipelineCommand(out IEnumerable pipelineInputFromScript) { ExTraceGlobals.IntegrationTracer.Information((long)this.GetHashCode(), "-->MonadCommand.GetPipelineCommand()"); if (this.CommandText.Contains(" ") && this.CommandType == CommandType.StoredProcedure) { throw new InvalidOperationException("CommandType.StoredProcedure cannot be used to run scripts. Add any parameters to the Parameters collection."); } ExTraceGlobals.IntegrationTracer.Information <string>((long)this.GetHashCode(), "\tCreating command {0}", this.CommandText); bool flag = this.CommandType == CommandType.Text; PSCommand pscommand = null; pipelineInputFromScript = null; if (this.Connection != null && this.Connection.IsRemote && this.CommandType == CommandType.Text && MonadCommand.scriptRegex.IsMatch(this.CommandText)) { this.ConvertScriptToStoreProcedure(this.CommandText, out pscommand, out pipelineInputFromScript); } else { pscommand = new PSCommand().AddCommand(new Command(this.CommandText, flag, !flag)); foreach (object obj in this.Parameters) { MonadParameter monadParameter = (MonadParameter)obj; if (ParameterDirection.Input != monadParameter.Direction) { throw new InvalidOperationException("ParameterDirection.Input is the only supported parameter type."); } ExTraceGlobals.IntegrationTracer.Information <string, object>((long)this.GetHashCode(), "\tAdding parameter {0} = {1}", monadParameter.ParameterName, monadParameter.Value); if (this.connection.IsRemote && MonadCommand.CanSerialize(monadParameter.Value)) { if (monadParameter.Value is ICollection) { pscommand.AddParameter(monadParameter.ParameterName, MonadCommand.Serialize(monadParameter.Value as IEnumerable)); } else { pscommand.AddParameter(monadParameter.ParameterName, MonadCommand.Serialize(monadParameter.Value)); } } else if (monadParameter.IsSwitch) { pscommand.AddParameter(monadParameter.ParameterName, true); } else { pscommand.AddParameter(monadParameter.ParameterName, monadParameter.Value); } } } ExTraceGlobals.IntegrationTracer.Information((long)this.GetHashCode(), "<--MonadCommand.GetPipelineCommand()"); return(pscommand); }
// Token: 0x060010F2 RID: 4338 RVA: 0x00033F03 File Offset: 0x00032103 public MonadParameter Add(MonadParameter value) { this.InnerList.Add(value); return(value); }