internal static unsafe DeployedStatefulServiceReplica FromNative(NativeTypes.FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM nativeObj) { var serviceManifestName = string.Empty; string servicePackageActivationId = null; long hostProcessId = 0; var reconfigInformation = new ReconfigurationInformation(); if (nativeObj.Reserved != IntPtr.Zero) { var extended = (NativeTypes.FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM_EX1 *)nativeObj.Reserved; serviceManifestName = NativeTypes.FromNativeString(extended->ServiceManifestName); if (extended->Reserved != IntPtr.Zero) { var nativeResultItemEx2 = (NativeTypes.FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM_EX2 *)extended->Reserved; servicePackageActivationId = NativeTypes.FromNativeString(nativeResultItemEx2->ServicePackageActivationId); if (nativeResultItemEx2->Reserved != IntPtr.Zero) { var extended3 = (NativeTypes.FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM_EX3 *)nativeResultItemEx2->Reserved; hostProcessId = extended3->HostProcessId; var reconfigurationInformation = (NativeTypes.FABRIC_RECONFIGURATION_INFORMATION_QUERY_RESULT *)extended3->ReconfigurationInformation; reconfigInformation = new ReconfigurationInformation( (ReplicaRole)reconfigurationInformation->PreviousConfigurationRole, (ReconfigurationPhase)reconfigurationInformation->ReconfigurationPhase, (ReconfigurationType)reconfigurationInformation->ReconfigurationType, NativeTypes.FromNativeFILETIME(reconfigurationInformation->ReconfigurationStartTimeUtc)); } } } return(new DeployedStatefulServiceReplica { ServiceName = new Uri(NativeTypes.FromNativeString(nativeObj.ServiceName)), ServiceTypeName = NativeTypes.FromNativeString(nativeObj.ServiceTypeName), CodePackageName = NativeTypes.FromNativeString(nativeObj.CodePackageName), ServiceManifestName = serviceManifestName, ServicePackageActivationId = servicePackageActivationId, Partitionid = nativeObj.PartitionId, ReplicaStatus = (ServiceReplicaStatus)nativeObj.ReplicaStatus, Address = NativeTypes.FromNativeString(nativeObj.Address), ReplicaId = nativeObj.ReplicaId, ReplicaRole = (ReplicaRole)nativeObj.ReplicaRole, ServiceManifestVersion_ = NativeTypes.FromNativeString(nativeObj.ServiceManifestVersion), HostProcessId = hostProcessId, ReconfigurationInformation = reconfigInformation, }); }
#pragma warning restore 0618 internal static unsafe DeployedServiceReplica CreateFromNative( NativeTypes.FABRIC_DEPLOYED_SERVICE_REPLICA_QUERY_RESULT_ITEM nativeResultItem) { if ((ServiceKind)nativeResultItem.Kind == ServiceKind.Stateless) { NativeTypes.FABRIC_DEPLOYED_STATELESS_SERVICE_INSTANCE_QUERY_RESULT_ITEM nativeStatelessInstanceQueryResult = *(NativeTypes.FABRIC_DEPLOYED_STATELESS_SERVICE_INSTANCE_QUERY_RESULT_ITEM *)nativeResultItem.Value; return(DeployedStatelessServiceInstance.FromNative(nativeStatelessInstanceQueryResult)); } else if ((ServiceKind)nativeResultItem.Kind == ServiceKind.Stateful) { NativeTypes.FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM nativeStatefulServiceQueryResult = *(NativeTypes.FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM *)nativeResultItem.Value; return(DeployedStatefulServiceReplica.FromNative(nativeStatefulServiceQueryResult)); } else { AppTrace.TraceSource.WriteNoise( "DeployedServiceReplica.CreateFromNative", "Ignoring the result with unsupported ServiceKind value {0}", (int)nativeResultItem.Kind); return(null); } }