internal static unsafe ServicePartitionInformation FromNative(NativeTypes.FABRIC_SERVICE_PARTITION_INFORMATION nativePartition)
        {
            ServicePartitionInformation servicePartitionInfo = null;

            switch (nativePartition.Kind)
            {
            case NativeTypes.FABRIC_SERVICE_PARTITION_KIND.FABRIC_SERVICE_PARTITION_KIND_SINGLETON:
                servicePartitionInfo = SingletonPartitionInformation.FromNative((NativeTypes.FABRIC_SINGLETON_PARTITION_INFORMATION *)nativePartition.Value);
                break;

            case NativeTypes.FABRIC_SERVICE_PARTITION_KIND.FABRIC_SERVICE_PARTITION_KIND_INT64_RANGE:
                servicePartitionInfo = Int64RangePartitionInformation.FromNative((NativeTypes.FABRIC_INT64_RANGE_PARTITION_INFORMATION *)nativePartition.Value);
                break;

            case NativeTypes.FABRIC_SERVICE_PARTITION_KIND.FABRIC_SERVICE_PARTITION_KIND_NAMED:
                servicePartitionInfo = NamedPartitionInformation.FromNative((NativeTypes.FABRIC_NAMED_PARTITION_INFORMATION *)nativePartition.Value);
                break;

            default:
                AppTrace.TraceSource.WriteError("ServicePartitionInformation.FromNative", "Unknown partition kind: {0}", nativePartition.Kind);
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.Error_PartitionKindUnknown_Formatted, nativePartition.Kind));
            }

            return(servicePartitionInfo);
        }
        internal static unsafe NamedPartitionInformation FromNative(NativeTypes.FABRIC_NAMED_PARTITION_INFORMATION *nativePartition)
        {
            var namedPartitionInfo = new NamedPartitionInformation();

            namedPartitionInfo.Id   = nativePartition->Id;
            namedPartitionInfo.Name = NativeTypes.FromNativeString(nativePartition->Name);

            return(namedPartitionInfo);
        }