private static bool TryGetCommandName( IDictionary <string, object> valueSet, out ServiceCommandName commandName, out IServiceCommandResponse errorResponse) { if (!valueSet.TryGetValue(ParamName.CommandName.ToString(), out object rawValue)) { errorResponse = ServiceCommandResponse.CreateError( ServiceCommandName.Unknown, ServiceErrorInfo.MissingRequiredMessageValue(ParamName.CommandName)); commandName = ServiceCommandName.Unknown; return(false); } if (!Enum.TryParse(rawValue.ToString(), out commandName)) { errorResponse = ServiceCommandResponse.CreateError( ServiceCommandName.Unknown, ServiceErrorInfo.WrongMessageValueType( ParamName.CommandName, rawValue.GetType(), typeof(ServiceCommandName))); commandName = ServiceCommandName.Unknown; return(false); } errorResponse = null; return(true); }
//// =========================================================================================================== //// Constructors //// =========================================================================================================== private ServiceCommandResponse( ServiceCommandName commandName, object result, ServiceCommandErrorCode errorCode, string errorMessage) { CommandName = commandName; Result = result; ErrorCode = errorCode; ErrorMessage = errorMessage; }
protected RegistryReadValueCommand( ServiceCommandName commandName, RegistryBaseKey baseKey, string key, string valueName, T defaultValue) : base(commandName) { BaseKey = baseKey; Key = Param.VerifyString(key, nameof(key)); ValueName = valueName; DefaultValue = defaultValue; }
public static ServiceCommandResponse CreateError(ServiceCommandName commandName, Exception exception) { return(CreateError(commandName, ServiceErrorInfo.InternalError(exception.Message))); }
public static ServiceCommandResponse CreateError( ServiceCommandName commandName, ServiceErrorInfo errorInfo) { return(new ServiceCommandResponse(commandName, null, errorInfo.ErrorCode, errorInfo.ErrorMessage)); }
//// =========================================================================================================== //// Methods //// =========================================================================================================== public static ServiceCommandResponse Create(ServiceCommandName commandName, object result) { return(new ServiceCommandResponse(commandName, result, ServiceCommandErrorCode.Success, null)); }
public TestServiceCommand(ServiceCommandName commandName) : base(commandName) { }
//// =========================================================================================================== //// Constructors //// =========================================================================================================== protected ServiceCommand(ServiceCommandName commandName) { CommandName = commandName; }
//// =========================================================================================================== //// Constructors //// =========================================================================================================== private BridgeMessageDeserializer(IDictionary <string, object> valueSet, ServiceCommandName commandName) { ValueSet = valueSet; CommandName = commandName; }