internal ApplicationHealth(System.Fabric.Health.ApplicationHealth health) : base(health) { this.ApplicationUri = health.ApplicationName; this.DeployedApplicationHealthStates = health.DeployedApplicationHealthStates .Select(state => new DeployedApplicationHealthState( state.ApplicationName.OriginalString, state.NodeName, state.AggregatedHealthState)); this.ServiceHealthStates = health.ServiceHealthStates .Select(state => new ServiceHealthState( state.ServiceName, state.AggregatedHealthState)); }
private static unsafe ApplicationHealth FromNative(NativeTypes.FABRIC_APPLICATION_HEALTH *nativeHealth) { var managedHealth = new ApplicationHealth(); managedHealth.AggregatedHealthState = (HealthState)nativeHealth->AggregatedHealthState; managedHealth.HealthEvents = HealthEvent.FromNativeList(nativeHealth->HealthEvents); managedHealth.ApplicationName = NativeTypes.FromNativeUri(nativeHealth->ApplicationName); managedHealth.ServiceHealthStates = ServiceHealthState.FromNativeList(nativeHealth->ServiceHealthStates); managedHealth.DeployedApplicationHealthStates = DeployedApplicationHealthState.FromNativeList(nativeHealth->DeployedApplicationHealthStates); if (nativeHealth->Reserved != IntPtr.Zero) { var nativeHealthEx1 = (NativeTypes.FABRIC_APPLICATION_HEALTH_EX1 *)nativeHealth->Reserved; managedHealth.UnhealthyEvaluations = HealthEvaluation.FromNativeList(nativeHealthEx1->UnhealthyEvaluations); if (nativeHealthEx1->Reserved != IntPtr.Zero) { var nativeHealthEx2 = (NativeTypes.FABRIC_APPLICATION_HEALTH_EX2 *)nativeHealthEx1->Reserved; managedHealth.HealthStatistics = HealthStatistics.CreateFromNative(nativeHealthEx2->HealthStatistics); } } return(managedHealth); }