internal static unsafe ResolvedServicePartition FromNative(NativeClient.IFabricResolvedServicePartitionResult nativeResult)
        {
            if (nativeResult == null)
            {
                return(null);
            }

            var partition       = new ResolvedServicePartition(nativeResult);
            var nativePartition = (NativeTypes.FABRIC_RESOLVED_SERVICE_PARTITION *)nativeResult.get_Partition();

            partition.ServiceName = NativeTypes.FromNativeUri(nativePartition->ServiceName);
            if (nativePartition->EndpointCount > 0)
            {
                partition.Endpoints = InteropHelpers.ResolvedServiceEndpointCollectionHelper.CreateFromNative((int)nativePartition->EndpointCount, nativePartition->Endpoints);
            }
            else
            {
                partition.Endpoints = new List <ResolvedServiceEndpoint>(0);
            }

            partition.Info = ServicePartitionInformation.FromNative(nativePartition->Info);
            GC.KeepAlive(nativeResult);

            return(partition);
        }
        internal static unsafe ServicePartitionResolutionChange FromNative(NativeClient.IFabricResolvedServicePartitionResult nativeResult, int error)
        {
            Exception exception             = null;
            ResolvedServicePartition result = null;

            if (nativeResult == null)
            {
                exception = Utility.TranslateCOMExceptionToManaged(new ExceptionWrapper(error), "ServicePartitionResolutionChange");
            }
            else
            {
                result = ResolvedServicePartition.FromNative(nativeResult);
            }

            var args = new ServicePartitionResolutionChange(result, exception);

            return(args);
        }
Esempio n. 3
0
            public void OnChange(NativeClient.IFabricServiceManagementClient source, Int64 handlerId, NativeClient.IFabricResolvedServicePartitionResult partition, int error)
            {
                ReleaseAssert.AssertIfNot(
                    object.ReferenceEquals(source, this.client.NativePropertyClient),
                    "object.ReferenceEquals(source, this.client.NativePropertyClient)");

                ServicePartitionResolutionChange args = ServicePartitionResolutionChange.FromNative(partition, error);

                this.callback(this.client, handlerId, args);
            }
 private ResolvedServicePartition(NativeClient.IFabricResolvedServicePartitionResult nativeResult)
 {
     this.nativeResult         = nativeResult;
     this.nativeInternalResult = (NativeClient.IInternalFabricResolvedServicePartition)nativeResult;
 }