/// <summary> /// Constructor /// </summary> /// <param name="SQLCommand">SQL Command</param> /// <param name="CommandType">Command type</param> /// <param name="Parameters">Parameters</param> /// <param name="CallBack">Called when command has been executed</param> /// <param name="Object">Object</param> public Command(Action<Command, IList<dynamic>> CallBack, object Object, string SQLCommand, CommandType CommandType, IParameter[] Parameters) { this.SQLCommand = SQLCommand; this.CommandType = CommandType; this.CallBack = CallBack.Check((x, y) => { }); this.Object = Object; this.Parameters = Parameters.Check(new IParameter[0]); this.Finalizable = SQLCommand.Check("").ToUpperInvariant().Contains("SELECT"); }
/// <summary> /// Constructor /// </summary> /// <param name="SQLCommand">SQL Command</param> /// <param name="CommandType">Command type</param> /// <param name="Parameters">Parameters</param> /// <param name="ParameterStarter">Parameter starter</param> /// <param name="CallBack">Called when command has been executed</param> /// <param name="Object">Object</param> public Command(Action<Command, IList<dynamic>> CallBack, object Object, string SQLCommand, CommandType CommandType, string ParameterStarter, object[] Parameters) { this.SQLCommand = SQLCommand; this.CommandType = CommandType; this.Parameters = new List<IParameter>(); this.CallBack = CallBack.Check((x, y) => { }); this.Object = Object; this.Finalizable = SQLCommand.Check("").ToUpperInvariant().Contains("SELECT"); if (Parameters != null) { foreach (object Parameter in Parameters) { var TempParameter = Parameter as string; if (Parameter == null) this.Parameters.Add(new Parameter<object>(this.Parameters.Count().ToString(CultureInfo.InvariantCulture), default(DbType), null, ParameterDirection.Input, ParameterStarter)); else if (TempParameter != null) this.Parameters.Add(new StringParameter(this.Parameters.Count().ToString(CultureInfo.InvariantCulture), TempParameter, ParameterDirection.Input, ParameterStarter)); else this.Parameters.Add(new Parameter<object>(this.Parameters.Count().ToString(CultureInfo.InvariantCulture), Parameter, ParameterDirection.Input, ParameterStarter)); } } }