private void EnsureIsInitializedCore()
 {
     int num;
     int num2;
     InvokeDelegate delegate2 = new InvokerUtil().GenerateInvokeDelegate(this.Method, out num, out num2);
     this.outputParameterCount = num2;
     this.inputParameterCount = num;
     this.invokeDelegate = delegate2;
 }
        private void EnsureIsInitializedCore()
        {
            int            num;
            int            num2;
            InvokeDelegate delegate2 = new InvokerUtil().GenerateInvokeDelegate(this.Method, out num, out num2);

            this.outputParameterCount = num2;
            this.inputParameterCount  = num;
            this.invokeDelegate       = delegate2;
        }
Beispiel #3
0
        void EnsureIsInitializedCore()
        {
            // Only pass locals byref because InvokerUtil may store temporary results in the byref.
            // If two threads both reference this.count, temporary results may interact.
            int            inputParameterCount;
            int            outputParameterCount;
            InvokeDelegate invokeDelegate = new InvokerUtil().GenerateInvokeDelegate(this.Method, out inputParameterCount, out outputParameterCount);

            this.outputParameterCount = outputParameterCount;
            this.inputParameterCount  = inputParameterCount;
            this.invokeDelegate       = invokeDelegate; // must set this last due to ----
        }
Beispiel #4
0
        internal InstanceBehavior(DispatchRuntime dispatch, ImmutableDispatchRuntime immutableRuntime)
        {
            this.useSession       = dispatch.ChannelDispatcher.Session;
            this.immutableRuntime = immutableRuntime;
            this.host             = (dispatch.ChannelDispatcher == null) ? null : dispatch.ChannelDispatcher.Host;
            this.initializers     = EmptyArray <IInstanceContextInitializer> .ToArray(dispatch.InstanceContextInitializers);

            this.provider  = dispatch.InstanceProvider;
            this.singleton = dispatch.SingletonInstanceContext;
            this.transactionAutoCompleteOnSessionClose       = dispatch.TransactionAutoCompleteOnSessionClose;
            this.releaseServiceInstanceOnTransactionComplete = dispatch.ReleaseServiceInstanceOnTransactionComplete;
            this.isSynchronized          = (dispatch.ConcurrencyMode != ConcurrencyMode.Multiple);
            this.instanceContextProvider = dispatch.InstanceContextProvider;

            if (this.provider == null)
            {
                ConstructorInfo constructor = null;
                if (dispatch.Type != null)
                {
                    constructor = InstanceBehavior.GetConstructor(dispatch.Type);
                }

                if (this.singleton == null)
                {
                    if (dispatch.Type != null && (dispatch.Type.IsAbstract || dispatch.Type.IsInterface))
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxServiceTypeNotCreatable)));
                    }

                    if (constructor == null)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxNoDefaultConstructor)));
                    }
                }

                if (constructor != null)
                {
                    if (this.singleton == null || !this.singleton.IsWellKnown)
                    {
                        InvokerUtil            util    = new InvokerUtil();
                        CreateInstanceDelegate creator = util.GenerateCreateInstanceDelegate(dispatch.Type, constructor);
                        this.provider = new InstanceProvider(creator);
                    }
                }
            }

            if (this.singleton != null)
            {
                this.singleton.Behavior = this;
            }
        }
        internal InstanceBehavior(DispatchRuntime dispatch, ImmutableDispatchRuntime immutableRuntime)
        {
            this.useSession = dispatch.ChannelDispatcher.Session;
            this.immutableRuntime = immutableRuntime;
            this.host = (dispatch.ChannelDispatcher == null) ? null : dispatch.ChannelDispatcher.Host;
            this.initializers = EmptyArray<IInstanceContextInitializer>.ToArray(dispatch.InstanceContextInitializers);
            this.provider = dispatch.InstanceProvider;
            this.singleton = dispatch.SingletonInstanceContext;
            this.transactionAutoCompleteOnSessionClose = dispatch.TransactionAutoCompleteOnSessionClose;
            this.releaseServiceInstanceOnTransactionComplete = dispatch.ReleaseServiceInstanceOnTransactionComplete;
            this.isSynchronized = (dispatch.ConcurrencyMode != ConcurrencyMode.Multiple);
            this.instanceContextProvider = dispatch.InstanceContextProvider;

            if (this.provider == null)
            {
                ConstructorInfo constructor = null;
                if (dispatch.Type != null)
                {
                    constructor = InstanceBehavior.GetConstructor(dispatch.Type);
                }

                if (this.singleton == null)
                {
                    if (dispatch.Type != null && (dispatch.Type.IsAbstract || dispatch.Type.IsInterface))
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxServiceTypeNotCreatable)));
                    }

                    if (constructor == null)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxNoDefaultConstructor)));
                    }
                }

                if (constructor != null)
                {
                    if (this.singleton == null || !this.singleton.IsWellKnown)
                    {
                        InvokerUtil util = new InvokerUtil();
                        CreateInstanceDelegate creator = util.GenerateCreateInstanceDelegate(dispatch.Type, constructor);
                        this.provider = new InstanceProvider(creator);
                    }
                }
            }

            if (this.singleton != null)
            {
                this.singleton.Behavior = this;
            }
        }
Beispiel #6
0
 private void EnsureIsInitialized()
 {
     if (this.invokeBeginDelegate == null)
     {
         int num;
         int num2;
         System.ServiceModel.Dispatcher.InvokeBeginDelegate delegate2 = new InvokerUtil().GenerateInvokeBeginDelegate(this.beginMethod, out num);
         this.inputParameterCount = num;
         System.ServiceModel.Dispatcher.InvokeEndDelegate delegate3 = new InvokerUtil().GenerateInvokeEndDelegate(this.endMethod, out num2);
         this.outputParameterCount = num2;
         this.invokeEndDelegate    = delegate3;
         this.invokeBeginDelegate  = delegate2;
     }
 }
 private void EnsureIsInitialized()
 {
     if (this.invokeBeginDelegate == null)
     {
         int num;
         int num2;
         System.ServiceModel.Dispatcher.InvokeBeginDelegate delegate2 = new InvokerUtil().GenerateInvokeBeginDelegate(this.beginMethod, out num);
         this.inputParameterCount = num;
         System.ServiceModel.Dispatcher.InvokeEndDelegate delegate3 = new InvokerUtil().GenerateInvokeEndDelegate(this.endMethod, out num2);
         this.outputParameterCount = num2;
         this.invokeEndDelegate = delegate3;
         this.invokeBeginDelegate = delegate2;
     }
 }
        void EnsureIsInitialized()
        {
            if (this.invokeBeginDelegate == null)
            {
                // Only pass locals byref because InvokerUtil may store temporary results in the byref.
                // If two threads both reference this.count, temporary results may interact.
                int inputParameterCount;
                InvokeBeginDelegate invokeBeginDelegate = new InvokerUtil().GenerateInvokeBeginDelegate(this.beginMethod, out inputParameterCount);
                this.inputParameterCount = inputParameterCount;

                int outputParameterCount;
                InvokeEndDelegate invokeEndDelegate = new InvokerUtil().GenerateInvokeEndDelegate(this.endMethod, out outputParameterCount);
                this.outputParameterCount = outputParameterCount;
                this.invokeEndDelegate = invokeEndDelegate;
                this.invokeBeginDelegate = invokeBeginDelegate;  // must set this last due to ----
            }
        }
Beispiel #9
0
 private void EnsureIsInitializedCore()
 {
     // Only pass locals byref because InvokerUtil may store temporary results in the byref.
     // If two threads both reference this.count, temporary results may interact.
     int inputParameterCount;
     int outputParameterCount;
     var invokeDelegate = new InvokerUtil().GenerateInvokeDelegate(Method, out inputParameterCount, out outputParameterCount);
     _outputParameterCount = outputParameterCount;
     _inputParameterCount = inputParameterCount;
     _invokeDelegate = invokeDelegate;  // must set this last due to race
 }