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);
        }
Esempio n. 2
0
        internal static unsafe Int64RangePartitionInformation FromNative(NativeTypes.FABRIC_INT64_RANGE_PARTITION_INFORMATION *nativePartition)
        {
            var int64RangePartitionInfo = new Int64RangePartitionInformation();

            int64RangePartitionInfo.Id      = nativePartition->Id;
            int64RangePartitionInfo.LowKey  = nativePartition->LowKey;
            int64RangePartitionInfo.HighKey = nativePartition->HighKey;

            return(int64RangePartitionInfo);
        }