Пример #1
0
        public static T ResolveValueRefs <T>(
            this T specification,
            IReadOnlyDictionary <string, object> values,
            ReferenceResolutionSettings settings = null)
            where T : Specification
        {
            ValueReferenceVisitor visitor = new ValueReferenceVisitor(values, settings);

            return((T)visitor.Visit(specification));
        }
Пример #2
0
        public static T ResolveSpecificationRefs <T>(
            this T specification,
            IReadOnlyDictionary <string, object> values,
            ReferenceResolutionSettings settings = null)
            where T : Specification
        {
            if (typeof(T) == typeof(ReferenceSpecification))
            {
                throw new Exception(
                          $"This method should not be used with type {typeof(ReferenceSpecification)}. Use instance method {typeof(ReferenceSpecification).GetMethod(nameof(ReferenceSpecification.ResolveSpecificationRefs))} instead.");
            }

            SpecificationReferenceVisitor visitor = new SpecificationReferenceVisitor(values, settings);

            return((T)visitor.Visit(specification));
        }