public void Execute(ServerData data, SourceServerData sourceData) { var dataBases = new List<IRepository> { new ProdDB(), new QADB() }; foreach (var dataBase in dataBases.Where(dataBase => ((IRule)dataBase).IsValid(data, sourceData))) { dataBase.Save(); } }
private bool IsValid(ServerData data, SourceServerData sourceData) { var validators = new List<IValidator> { new IPValidator(), new TypeValidator() }; return new Validator(validators).Validate(data, sourceData); }
private void Migrate(ServerData data) { try { //Migrate data from server to server _logger.InfoFormat("Migrating data with Id:{0}", data.Id); } catch (Exception ex) { _logger.ErrorFormat("An exception occurred attempting to migrate data with Id:{0}", data.Id); throw; } }
public bool Validate(ServerData data, SourceServerData sourceData) { return data.Type == sourceData.Type; }
public bool Validate(ServerData data, SourceServerData sourceData) { return data.IP != sourceData.IP; }
public bool Validate(ServerData data, SourceServerData sourceData) { return _validators.Any(validator => validator.Validate(data, sourceData)); }
public bool IsValid(ServerData data, SourceServerData sourceData) { return new Validator(new List<IValidator>()).Validate(data, sourceData); }
public override bool IsValid(ServerData data, SourceServerData sourceData) { return base.IsValid(data, sourceData); }