Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 5
0
 protected bool Equals(ParameterDispatch other)
 {
     return(_identifier == other._identifier);
 }
Ejemplo n.º 6
0
 protected bool Equals(ParameterDispatch other)
 {
     return _identifier == other._identifier;
 }