Esempio n. 1
0
 public IAddressModel Select(AddressSelectContext context)
 {
     Check.NotNull(context, nameof(context));
     if (context.AddressModels.Count(p => p.Enabled) == 1 &&
         AddressSelectorMode != AddressSelectorMode.HashAlgorithm)
     {
         return(context.AddressModels.First(p => p.Enabled));
     }
     return(SelectAddressByAlgorithm(context));
 }
Esempio n. 2
0
        protected override IAddressModel SelectAddressByAlgorithm(AddressSelectContext context)
        {
            var index = _generate(0, context.AddressModels.Length);

            return(context.AddressModels[index]);
        }
Esempio n. 3
0
 protected abstract IAddressModel SelectAddressByAlgorithm(AddressSelectContext context);