Esempio n. 1
0
 public BillingRanValidator(IRelativityBillingRepo relBillingRepo, IRelativityProvidersRepo relProvidersRepo, BillingValidatorSettings billingSettings)
     : base(BillingValidatorProxy.BillingValidatorId)
 {
     this._relBillingRepo   = Guard.NotNull(relBillingRepo, "relBillingRepo", log);
     this._relProvidersRepo = Guard.NotNull(relProvidersRepo, "relProvidersRepo", log);
     this._billingSettings  = Guard.NotNull(billingSettings, "billingSettings", log);
 }
        public IValidator Create(IValidatorInstance validatorInstance)
        {
            BillingValidatorSettings settings = (BillingValidatorSettings)this._validatorInstances[validatorInstance];

            if (settings == null)
            {
                throw new Exception(string.Format("Billing Validator Instance not found: {0}", validatorInstance.Name));
            }

            log.Debug("BillingValidator: Creating BillingValidator ValidatorInstance  Name: {name}  Description: {description}", validatorInstance.Name, validatorInstance.Description);

            return(this._childKernel.Get <BillingRanValidator>(new ConstructorArgument(BillingRanValidator.BillingSettingsConstructorParameterName, settings)));
        }
        protected override void LoadValidatonInstances(List <ConfigSection> configValues)
        {
            if (this._validatorInstances == null)
            {
                this._validatorInstances = new Dictionary <IValidatorInstance, ValidatorSettings>();

                BillingValidatorSettings settings = new BillingValidatorSettings(configValues);

                var validatorInstance = new ValidatorInstance(this.ValidatorId, this.Name, this.Description);

                //Billing validator only ever one instance
                var validatorInstances = new List <ValidatorInstance>()
                {
                    validatorInstance
                };

                log.Debug("BillingValidator: {count} ValidatorInstances found available.", validatorInstances.Count);

                _validatorInstances.Add(validatorInstance, settings);
            }
        }