internal static PartitionSelector Read(BinaryReader br) { string s = br.ReadString(); Uri serviceName = new Uri(s); PartitionSelectorType selectorType = (PartitionSelectorType)br.ReadInt32(); string partitionKey = br.ReadString(); return(new PartitionSelector(serviceName, selectorType, partitionKey)); }
private PartitionSelector(Uri serviceName, PartitionSelectorType selectorType, string partitionKey) { Requires.ThrowIfNull(serviceName, "serviceName"); this.serviceName = serviceName; this.selectorType = selectorType; this.partitionKey = partitionKey; this.PowershellParameters = new Dictionary <string, string>(); this.PowershellParameters.Add(ServiceNameParameter, serviceName.OriginalString); switch (this.selectorType) { case PartitionSelectorType.Singleton: this.PowershellParameters.Add(PartitionKind, PartitionKindSingleton); break; case PartitionSelectorType.Named: this.PowershellParameters.Add(PartitionKind, PartitionKindNamed); this.PowershellParameters.Add(PartitionKey, this.partitionKey); break; case PartitionSelectorType.UniformInt64: this.PowershellParameters.Add(PartitionKind, PartitionKindUniformInt64); this.PowershellParameters.Add(PartitionKey, this.partitionKey); break; case PartitionSelectorType.PartitionId: this.PowershellParameters.Add(PartitionId, this.partitionKey); break; case PartitionSelectorType.Random: break; default: this.ThrowInvalidPartitionSelector(); break; } }