internal static object NormalizeManagerPartitionKey(object partitionKey) { if (partitionKey == null || partitionKey is string) { return(partitionKey); } var key = partitionKey as IntegerPartitionKeyRange; if (key != null) { var range = key; var nativeRange = new NativeReliableMessaging.INTEGER_PARTITION_KEY_RANGE { IntegerKeyLow = range.IntegerKeyLow, IntegerKeyHigh = range.IntegerKeyHigh }; return(nativeRange); } if (partitionKey is long) { var singleNumber = (long)partitionKey; var nativeRange = new NativeReliableMessaging.INTEGER_PARTITION_KEY_RANGE { IntegerKeyLow = singleNumber, IntegerKeyHigh = singleNumber }; return(nativeRange); } throw new ArgumentException(SR.Error_PartitionKey_Format_Unsupported); }
/// <summary> /// Populates this struct from native stats. /// </summary> /// <param name="nativeKeyRange"></param> /// <returns></returns> internal static IntegerPartitionKeyRange FromNative(NativeReliableMessaging.INTEGER_PARTITION_KEY_RANGE nativeKeyRange) { var keyRange = new IntegerPartitionKeyRange { IntegerKeyLow = nativeKeyRange.IntegerKeyLow, IntegerKeyHigh = nativeKeyRange.IntegerKeyHigh }; return(keyRange); }