internal static unsafe StatelessServiceInstance FromNative(NativeTypes.FABRIC_STATELESS_SERVICE_INSTANCE_QUERY_RESULT_ITEM statelessInstanceResultItem) { return(new StatelessServiceInstance( (System.Fabric.Query.ServiceReplicaStatus)statelessInstanceResultItem.ReplicaStatus, (HealthState)statelessInstanceResultItem.HealthState, NativeTypes.FromNativeString(statelessInstanceResultItem.ReplicaAddress), NativeTypes.FromNativeString(statelessInstanceResultItem.NodeName), statelessInstanceResultItem.InstanceId, TimeSpan.FromSeconds(statelessInstanceResultItem.LastInBuildDurationInSeconds))); }
internal static unsafe Replica CreateFromNative( NativeTypes.FABRIC_SERVICE_REPLICA_QUERY_RESULT_ITEM nativeResultItem) { if ((ServiceKind)nativeResultItem.Kind == ServiceKind.Stateless) { NativeTypes.FABRIC_STATELESS_SERVICE_INSTANCE_QUERY_RESULT_ITEM nativeStatelessInstanceQueryResult = *(NativeTypes.FABRIC_STATELESS_SERVICE_INSTANCE_QUERY_RESULT_ITEM *)nativeResultItem.Value; return(StatelessServiceInstance.FromNative(nativeStatelessInstanceQueryResult)); } else if ((ServiceKind)nativeResultItem.Kind == ServiceKind.Stateful) { NativeTypes.FABRIC_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM nativeStatefulServiceQueryResult = *(NativeTypes.FABRIC_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM *)nativeResultItem.Value; return(StatefulServiceReplica.FromNative(nativeStatefulServiceQueryResult)); } else { AppTrace.TraceSource.WriteNoise( "Replica.CreateFromNative", "Ignoring the result with unsupported ServiceKind value {0}", (int)nativeResultItem.Kind); return(null); } }