public void Initialize(InstanceContext instanceContext, Message message)
 {
     object pIUnknown = null;
     pIUnknown = this.SetupServiceConfig(instanceContext, message);
     IServiceActivity activity = (IServiceActivity) System.ServiceModel.ComIntegration.SafeNativeMethods.CoCreateActivity(pIUnknown, IID_IServiceActivity);
     bool postSynchronous = this.info.ThreadingModel == ThreadingModel.MTA;
     ComPlusSynchronizationContext context = new ComPlusSynchronizationContext(activity, postSynchronous);
     instanceContext.SynchronizationContext = context;
     instanceContext.Closing += new EventHandler(this.OnInstanceContextClosing);
     Marshal.ReleaseComObject(pIUnknown);
 }
        public void Initialize(InstanceContext instanceContext, Message message)
        {
            object pIUnknown = null;

            pIUnknown = this.SetupServiceConfig(instanceContext, message);
            IServiceActivity activity             = (IServiceActivity)System.ServiceModel.ComIntegration.SafeNativeMethods.CoCreateActivity(pIUnknown, IID_IServiceActivity);
            bool             postSynchronous      = this.info.ThreadingModel == ThreadingModel.MTA;
            ComPlusSynchronizationContext context = new ComPlusSynchronizationContext(activity, postSynchronous);

            instanceContext.SynchronizationContext = context;
            instanceContext.Closing += new EventHandler(this.OnInstanceContextClosing);
            Marshal.ReleaseComObject(pIUnknown);
        }
        public void Initialize(InstanceContext instanceContext, Message message)
        {
            object serviceConfig = null;
            serviceConfig = SetupServiceConfig(instanceContext, message);

            IServiceActivity activity;
            activity = (IServiceActivity)SafeNativeMethods.CoCreateActivity(
                serviceConfig,
                IID_IServiceActivity);

            ComPlusSynchronizationContext syncContext;
            bool postSynchronous = (this.info.ThreadingModel ==
                                    ThreadingModel.MTA);
            syncContext = new ComPlusSynchronizationContext(activity,
                                                            postSynchronous);
            instanceContext.SynchronizationContext = syncContext;

            instanceContext.Closing += this.OnInstanceContextClosing;
            Marshal.ReleaseComObject(serviceConfig);
        }
        public void Initialize(InstanceContext instanceContext, Message message)
        {
            object serviceConfig = null;

            serviceConfig = SetupServiceConfig(instanceContext, message);

            IServiceActivity activity;

            activity = (IServiceActivity)SafeNativeMethods.CoCreateActivity(
                serviceConfig,
                IID_IServiceActivity);

            ComPlusSynchronizationContext syncContext;
            bool postSynchronous = (this.info.ThreadingModel ==
                                    ThreadingModel.MTA);

            syncContext = new ComPlusSynchronizationContext(activity,
                                                            postSynchronous);
            instanceContext.SynchronizationContext = syncContext;

            instanceContext.Closing += this.OnInstanceContextClosing;
            Marshal.ReleaseComObject(serviceConfig);
        }