internal static unsafe StatefulServiceReplica FromNative(NativeTypes.FABRIC_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM statefulReplicaResultItem)
 {
     return(new StatefulServiceReplica(
                (System.Fabric.Query.ServiceReplicaStatus)statefulReplicaResultItem.ReplicaStatus,
                (HealthState)statefulReplicaResultItem.HealthState,
                (System.Fabric.ReplicaRole)statefulReplicaResultItem.ReplicaRole,
                NativeTypes.FromNativeString(statefulReplicaResultItem.ReplicaAddress),
                NativeTypes.FromNativeString(statefulReplicaResultItem.NodeName),
                statefulReplicaResultItem.ReplicaId,
                TimeSpan.FromSeconds(statefulReplicaResultItem.LastInBuildDurationInSeconds)));
 }
Exemple #2
0
 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);
     }
 }