Esempio n. 1
0
        protected override IExtendedAsyncResult <TRes> ProcessBeginCall <TRes>(
            MethodInvocationParams mip, Action <IExtendedAsyncResult <TRes> > callBack, object userState)
        {
            var asyncMethods = _getAsyncMethods(mip.Method);

            var callResult = new WcfExtendedAsyncResult <TRes>(_service, callBack, asyncMethods.EndCall);

            // obserwacja: jeśli poleci callback, to będzie miał oryginalne iasyncresult => nie potrzebujemy więc go w WcfExtendedAsyncResult w takim przypadku - tłumacz może go nam wyprodukować!
            // obserwacja: potrzebujemy gotowe WcfExtendedAsyncResult tylko gdy wychodziny stąd! czyli możemy to gówno ustawić przy wychodzeniu!
            // todo: straszna to wioska jest, ale cóż....
            callResult.OrgAsyncResult = asyncMethods.BeginCall(
                _service,
                mip.Arguments,
                WrapSynchonizationContextIfNeeded(callResult.FireOnInternalWcfCallCompleted),
                userState);

            return(callResult);
        }
Esempio n. 2
0
        public void Intercept(IInvocation invocation)
        {
            // todo: generic method handling - not applicable to Wcf, but usefull!
//			MethodInfo mi = invocation.Method.IsGenericMethod
//				? invocation.Method.GetGenericMethodDefinition()
//				: invocation.Method;
            //invocation.Method
            //invocation.ReturnValue
            //invocation.GenericArguments
            //invocation.Arguments
            var mip = new MethodInvocationParams(
                invocation.Method,
                invocation.Arguments,
                invocation.GenericArguments);

            _setInvoicationParams(mip);

            var retType = invocation.Method.ReturnType;

            if (retType.IsValueType && retType != typeof(void))
            {
                invocation.ReturnValue = Activator.CreateInstance(invocation.Method.ReturnType);
            }
        }