コード例 #1
0
        private void Execute(IHandleStrategy strategy)
        {
            using (SqlConnection connection = CreateConnection())
            {
                SqlCommand command = CreateCommand(connection);

                Dictionary <string, SqlParameter> p = Parameters.ToSqlParameters();

                AddParametersToCommand(command, p);

                connection.Open();

                strategy.Execute(command);

                Parameters.UpdateValues(p);
            }
        }
コード例 #2
0
 private IHandleStrategy handleStrategy;                       //currently used handling strategy
 public ConcreteRequestHandler(IHandleStrategy handleStrategy) //conctructs new instance with given strategy
 {
     this.handleStrategy = handleStrategy;
 }