public AsyncOperationDispatch(OperationContractAttribute operation, MethodInfo methodInfo, int identifier)
            : base(methodInfo, identifier)
        {
            _operation = operation;
            ParameterInfo[] allParameters        = methodInfo.GetParameters();
            var             serializedParameters = allParameters;

            if (Operation.AsyncPattern)
            {
                var isAsyncResultPattern =
                    methodInfo.Name.StartsWith("Begin", StringComparison.InvariantCultureIgnoreCase) &&
                    allParameters.Last().ParameterType == typeof(object) &&
                    allParameters.Skip(allParameters.Length - 1).Last().ParameterType == typeof(AsyncCallback) &&
                    methodInfo.ReturnType == typeof(IAsyncResult);
                if (isAsyncResultPattern)
                {
                    var endName = methodInfo.Name.Replace("Begin", "End");
                    _endAsync = methodInfo.DeclaringType.GetMethod(endName);
                    Debug.Assert(_endAsync.ReturnType == typeof(void));
                }
                serializedParameters = allParameters.Take(allParameters.Length - 2).ToArray();
            }

            foreach (var p in serializedParameters)
            {
                var map = new ParameterDispatch(p);
                _params.Add(map.Identifier, map);
            }
        }
        public AsyncOperationDispatch(OperationContractAttribute operation, MethodInfo methodInfo, int identifier)
            : base(methodInfo, identifier)
        {
            _operation = operation;
            ParameterInfo[] allParameters = methodInfo.GetParameters();
            var serializedParameters = allParameters;
            if (Operation.AsyncPattern)
            {
                var isAsyncResultPattern =
                    methodInfo.Name.StartsWith("Begin", StringComparison.InvariantCultureIgnoreCase)
                    && allParameters.Last().ParameterType == typeof(object)
                    && allParameters.Skip(allParameters.Length - 1).Last().ParameterType == typeof(AsyncCallback)
                    && methodInfo.ReturnType == typeof(IAsyncResult);
                if (isAsyncResultPattern)
                {
                    var endName = methodInfo.Name.Replace("Begin", "End");
                    _endAsync = methodInfo.DeclaringType.GetMethod(endName);
                    Debug.Assert(_endAsync.ReturnType == typeof(void));
                }
                serializedParameters = allParameters.Take(allParameters.Length - 2).ToArray();
            }

            foreach (var p in serializedParameters)
            {
                var map = new ParameterDispatch(p);
                _params.Add(map.Identifier, map);
            }
        }
Beispiel #3
0
        public OperationDispatch(OperationContractAttribute operation, MethodInfo methodInfo, int identifier)
            : base(methodInfo, identifier)
        {
            _operation = operation;
            var allParameters = methodInfo.GetParameters();

            foreach (var p in allParameters)
            {
                var map = new ParameterDispatch(p);
                _params.Add(map.Identifier, map);
            }
        }
Beispiel #4
0
        public OperationDispatch(OperationContractAttribute operation, MethodInfo methodInfo, int identifier)
            : base(methodInfo, identifier)
        {
            _operation = operation;
            var allParameters = methodInfo.GetParameters();



            foreach (var p in allParameters)
            {
                var map = new ParameterDispatch(p);
                _params.Add(map.Identifier, map);
            }
        }
 protected bool Equals(ParameterDispatch other)
 {
     return(_identifier == other._identifier);
 }
Beispiel #6
0
 protected bool Equals(ParameterDispatch other)
 {
     return _identifier == other._identifier;
 }