public void Execute(API.CommandManager manager, IRemoteCommandArguments arguments) { var args = (SelectArguments)arguments; Guard.ArgumentNotNullForCommand<Select>(args.Selector); API.FieldCommands.Select selectCommand = null; if (args.SelectMode.HasValue) { if (args.Value != null) { selectCommand = manager.Select(args.Value, args.SelectMode.Value); } else if (args.Values != null) { selectCommand = manager.Select(args.SelectMode.Value, args.Values.ToArray()); } else if (args.Index != null) { selectCommand = manager.Select(args.Index.Value); } else if (args.Indices != null) { selectCommand = manager.Select(args.Indices.ToArray()); } else if (args.ValueExpression != null) { selectCommand = manager.Select(args.ValueExpression, args.SelectMode.Value); } else { throw new InvalidCommandException<Select>(); } } else { if (args.Value != null) { selectCommand = manager.Select(args.Value); } else if (args.Values != null) { selectCommand = manager.Select(args.Values.ToArray()); } else if (args.Index != null) { selectCommand = manager.Select(args.Index.Value); } else if (args.Indices != null) { selectCommand = manager.Select(args.Indices.ToArray()); } else if (args.ValueExpression != null) { selectCommand = manager.Select(args.ValueExpression); } else { throw new InvalidCommandException<Select>(); } } if (args.MatchConditions.HasValue) { selectCommand.From(args.Selector, args.MatchConditions.Value); } else { selectCommand.From(args.Selector); } }