internal static bool AreEqual(ApplicationHealthPolicy current, ApplicationHealthPolicy other) { if ((current != null) && (other != null)) { if ((current.ConsiderWarningAsError != other.ConsiderWarningAsError) || (current.MaxPercentUnhealthyDeployedApplications != other.MaxPercentUnhealthyDeployedApplications) || (!ServiceTypeHealthPolicy.AreEqualWithNullAsDefault(current.DefaultServiceTypeHealthPolicy, other.DefaultServiceTypeHealthPolicy)) || (current.ServiceTypeHealthPolicyMap.Count != other.ServiceTypeHealthPolicyMap.Count)) { return(false); } foreach (var currentItem in current.ServiceTypeHealthPolicyMap) { ServiceTypeHealthPolicy otherValue; var success = other.ServiceTypeHealthPolicyMap.TryGetValue(currentItem.Key, out otherValue); if (!success) { return(false); } if (!ServiceTypeHealthPolicy.AreEqual(currentItem.Value, otherValue)) { return(false); } } return(true); } else { return((current == null) && (other == null)); } }
internal static unsafe ApplicationHealthPolicy FromNative(IntPtr nativeApplicationHealthPolicyPtr) { var applicationHealthPolicy = new ApplicationHealthPolicy(); if (nativeApplicationHealthPolicyPtr == IntPtr.Zero) { return(applicationHealthPolicy); } var nativeApplicationHealthPolicy = (NativeTypes.FABRIC_APPLICATION_HEALTH_POLICY *)nativeApplicationHealthPolicyPtr; applicationHealthPolicy.ConsiderWarningAsError = NativeTypes.FromBOOLEAN(nativeApplicationHealthPolicy->ConsiderWarningAsError); applicationHealthPolicy.MaxPercentUnhealthyDeployedApplications = nativeApplicationHealthPolicy->MaxPercentUnhealthyDeployedApplications; applicationHealthPolicy.DefaultServiceTypeHealthPolicy = ServiceTypeHealthPolicy.FromNative(nativeApplicationHealthPolicy->DefaultServiceTypeHealthPolicy); ServiceTypeHealthPolicy.FromNativeMap( nativeApplicationHealthPolicy->ServiceTypeHealthPolicyMap, applicationHealthPolicy.ServiceTypeHealthPolicyMap); return(applicationHealthPolicy); }