示例#1
0
        public static string[] GeneratePartitionKeys(short partitionCount)
        {
            string[] strArrays = new string[partitionCount];
            int      num       = 0;
            int      num1      = 0;

            while (num1 < partitionCount)
            {
                string str = num.ToString(CultureInfo.InvariantCulture);
                short  entityLogicalPartition = ScaledEntityPartitionResolver.ResolveToEntityLogicalPartition(str, partitionCount);
                if (strArrays[entityLogicalPartition] == null)
                {
                    strArrays[entityLogicalPartition] = str;
                    num1++;
                }
                num++;
            }
            return(strArrays);
        }
示例#2
0
        public static bool MapsToSingleLogicalPartition(string[] values, short partitionCount)
        {
            bool flag = true;

            if ((int)values.Length > 0)
            {
                short entityLogicalPartition = ScaledEntityPartitionResolver.ResolveToEntityLogicalPartition(values[0], partitionCount);
                int   num = 1;
                while (num < (int)values.Length)
                {
                    if (ScaledEntityPartitionResolver.ResolveToEntityLogicalPartition(values[num], partitionCount) == entityLogicalPartition)
                    {
                        num++;
                    }
                    else
                    {
                        flag = false;
                        break;
                    }
                }
            }
            return(flag);
        }