コード例 #1
0
        public NativeRuntime.IFabricStatelessServiceInstance CreateInstance(
            IntPtr nativeServiceType,
            IntPtr nativeServiceName,
            uint initializationDataLength,
            IntPtr nativeInitializationData,
            Guid partitionId,
            long instanceId)
        {
            Func <IStatelessServiceFactory, ServiceInitializationParameters, IStatelessServiceInstance> creationFunc = (factory, initParams) =>
            {
                return(factory.CreateInstance(initParams.ServiceTypeName, initParams.ServiceName, initParams.InitializationData, partitionId, instanceId));
            };

            ServiceInitializationParameters initializationParameters = new StatelessServiceInitializationParameters(this.codePackageActivationContext)
            {
                InstanceId = instanceId
            };
            IStatelessServiceInstance statelessService = this.CreateHelper <IStatelessServiceFactory, IStatelessServiceInstance>(
                nativeServiceType,
                nativeServiceName,
                initializationDataLength,
                nativeInitializationData,
                partitionId,
                creationFunc,
                (inst, initParams) => inst.Initialize(initParams as StatelessServiceInitializationParameters),
                initializationParameters);

            return(new StatelessServiceBroker(statelessService, initializationParameters, instanceId));
        }
コード例 #2
0
        public ICommunicationListener CreateCommunicationListener(IStatelessServiceInstance instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            return(new AspNetCoreCommunicationListener(instance, WebHost, AddUrlPrefix));
        }
コード例 #3
0
        public ICommunicationListener CreateCommunicationListener(IStatelessServiceInstance instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            return new AspNetCoreCommunicationListener(instance, WebHost, AddUrlPrefix);
        }
コード例 #4
0
        internal StatelessServiceBroker(IStatelessServiceInstance statelessServiceInstance, ServiceInitializationParameters initializationParameters, long instanceId)
        {
            Requires.Argument("statelessServiceInstance", statelessServiceInstance).NotNull();
            Requires.Argument("initializationParameters", initializationParameters).NotNull();

            this.statelessService         = statelessServiceInstance;
            this.initializationParameters = initializationParameters;
            this.instanceId = instanceId;
        }
コード例 #5
0
        public AspNetCoreCommunicationListener(IStatelessServiceInstance instance, IWebHost webHost, bool addUrlPrefix)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            if (webHost == null)
            {
                throw new ArgumentNullException(nameof(webHost));
            }

            _instanceOrReplica = instance;
            _webHost = webHost;
            _addUrlPrefix = addUrlPrefix;
        }
コード例 #6
0
        public AspNetCoreCommunicationListener(IStatelessServiceInstance instance, IWebHost webHost, bool addUrlPrefix)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            if (webHost == null)
            {
                throw new ArgumentNullException(nameof(webHost));
            }

            _instanceOrReplica = instance;
            _webHost           = webHost;
            _addUrlPrefix      = addUrlPrefix;
        }