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); }
/// <summary> /// <para>Compares two resolved service partitions and identifies which is newer. </para> /// </summary> /// <param name="other"> /// <para>The other resolved service partition to compare.</para> /// </param> /// <returns> /// <para>Returns <see cref="System.Int32" />.</para> /// </returns> /// <exception cref="System.Fabric.FabricException"> /// <para>The two <see cref="System.Fabric.ResolvedServicePartition" /> objects are from different service partitions. This can happen if the /// service is deleted and re-created with the same name and partitioning between two resolve calls.</para> /// </exception> /// <remarks> /// <para>The <see cref="System.Fabric.ResolvedServicePartition.CompareVersion(System.Fabric.ResolvedServicePartition)" /> method takes in a /// resolved service partition (RSP) argument with the parameter <paramref name="other" /> to enable the user to identify which RSP is more /// up-to-date. A returned value of 0 indicates that the two RSPs have the same version. 1 indicates that the other RSP has an older version. /// -1 indicates that the other RSP has a newer version. </para> /// </remarks> public int CompareVersion(ResolvedServicePartition other) { Requires.Argument <ResolvedServicePartition>("other", other).NotNull(); return(Utility.WrapNativeSyncInvokeInMTA <int>( () => { return this.CompareVersionInternal(other); }, "ResolvedServicePartition.CompareVersion")); }
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); }
public void Initialize(Uri retry, PartInfo part, F.ResolvedServicePartition rsp) { this.ResolvedServicePartition = rsp; this.Info = rsp.Info; this.Part = part; var uris = getUris(); base.Initialize(part.Message.Headers.To, uris); // now add a router retry endpoint var retryEndpoint = new RouterEndpoint( this.Endpoints[0].Contract, this.Endpoints[0].Binding, new EndpointAddress(part.Message.Headers.To)); retryEndpoint.Behaviors.Add(new ClientViaBehavior(retry)); this.Endpoints.Add(retryEndpoint); }
private ServicePartitionResolutionChange(ResolvedServicePartition result, Exception exception) { this.Exception = exception; this.result = result; }
internal int CompareVersionInternal(ResolvedServicePartition other) { return(this.nativeResult.CompareVersion(other.NativeResult)); }