Пример #1
0
        /// <summary>
        /// Returns each subsection of <paramref name="fieldValue"/> which violates validation rules (e.g. the CHI found).
        /// </summary>
        /// <param name="fieldName"></param>
        /// <param name="fieldValue"></param>
        /// <returns></returns>
        protected virtual IEnumerable <FailurePart> Validate(string fieldName, string fieldValue)
        {
            // make sure that we have a cache for this column name
            var cache = Caches.GetOrAdd(fieldName, (v) => new MemoryCache(new MemoryCacheOptions()
            {
                SizeLimit = MaxValidationCacheSize
            }));

            //if we have the cached result use it
            if (cache.TryGetValue(fieldValue ?? "NULL", out FailurePart[] result))