コード例 #1
0
        private SpfConfigReadModelEntity Process(SpfConfig spfConfig)
        {
            Spf.Domain.SpfConfig    parsedConfig = _configParser.Parse(spfConfig);
            Spf.ReadModel.SpfConfig mappedConfig = parsedConfig.ToSpfConfig();
            string spfConfigSerialized           = JsonConvert.SerializeObject(mappedConfig, _serializerSettings);

            return(new SpfConfigReadModelEntity(spfConfig.Domain.Id, mappedConfig.TotalErrorCount, (ErrorType?)mappedConfig.MaxErrorSeverity, spfConfigSerialized));
        }
コード例 #2
0
        public static SpfConfig ToSpfConfig(this DomainSpfConfig domainSpfConfig)
        {
            List <SpfRecord> spfRecords = domainSpfConfig.Records.Select(ToSpfRecord).ToList();

            List <Error> errors = domainSpfConfig.Errors.Select(_ => _.ToError("Global"))
                                  .Concat(domainSpfConfig.Records.SelectMany((v, i) => v.AllErrors.Select(_ => _.ToError($"Record {i + 1}"))))
                                  .ToList();

            ErrorType?maxErrorSeverity = errors.Any()
                ? errors.Min(_ => _.ErrorType)
                : (ErrorType?)null;

            return(new SpfConfig(spfRecords, errors, domainSpfConfig.AllErrorCount, maxErrorSeverity, domainSpfConfig.LastChecked));
        }