/// <summary> /// Apply a command operation /// </summary> /// <param name="observed">observed operation</param> /// <param name="activator">command parameters</param> /// <returns>command operation</returns> public static CommandOperation Command(this IOperation observed, CommandActivator activator) { CommandOperation cmd = new CommandOperation(activator); observed.Subscribe(cmd); return cmd; }
/// <summary> /// Command operation constructor /// </summary> /// <param name="activator">command parameters</param> public CommandOperation(CommandActivator activator) { _activator = activator; }
/// <summary> /// Apply a command operation /// </summary> /// <param name="observed">observed operation</param> /// <param name="connStr">Name of a connection string defined in the application configuration file</param> /// <param name="CommandText">text of the command</param> /// <param name="isQuery">indicate if the command is a query</param> /// <param name="prepare">callback method to prepare the command</param> /// <returns>command operation</returns> public static CommandOperation Command(this IOperation observed, string connStr, string CommandText, bool isQuery, Action<IDbCommand, Row> prepare) { CommandActivator activator = new CommandActivator(); activator.ConnStringName = connStr; activator.CommandText = CommandText; activator.Prepare = prepare; activator.IsQuery = isQuery; return observed.Command(activator); }