Пример #1
0
        private void CreateNativeClient(
            FabricTransportSettings transportSettings,
            string connectionAddress,
            IFabricTransportClientEventHandler eventHandler,
            IFabricTransportCallbackMessageHandler contract,
            NativeFabricTransport.IFabricTransportMessageDisposer messageMessageDisposer)
        {
            var iid = typeof(NativeFabricTransport.IFabricTransportClient).GetTypeInfo().GUID;

            using (var pin = new PinCollection())
            {
                var nativeTransportSettings = transportSettings.ToNativeV2(pin);
                var messageHandler          = new FabricTransportCallbackHandlerBroker(contract);
                var nativeConnectionAddress = pin.AddBlittable(connectionAddress);
                var nativeEventHandler      = new FabricTransportClientConnectionEventHandlerBroker(eventHandler);
                this.nativeClient =
                    NativeFabricTransport.CreateFabricTransportClient(
                        ref iid,
                        nativeTransportSettings,
                        nativeConnectionAddress,
                        messageHandler,
                        nativeEventHandler,
                        messageMessageDisposer);
            }
        }
Пример #2
0
 public FabricTransportClient(
     FabricTransportSettings transportSettings,
     string connectionAddress,
     IFabricTransportClientEventHandler eventHandler,
     IFabricTransportCallbackMessageHandler contract,
     NativeFabricTransport.IFabricTransportMessageDisposer messageMessageDisposer)
 {
     this.ConnectionAddress = connectionAddress;
     this.settings          = transportSettings;
     Utility.WrapNativeSyncInvokeInMTA(
         () => this.CreateNativeClient(transportSettings, connectionAddress, eventHandler, contract, messageMessageDisposer),
         "FabricTransportClient.Create");
 }