コード例 #1
0
        //--------------------//

        #region Normalize
        /// <summary>
        /// Handles legacy elements (converts <see cref="Constraints"/> to <see cref="Versions"/>).
        /// </summary>
        /// <remarks>This method should be called to prepare a <see cref="Feed"/> for solver processing. Do not call it if you plan on serializing the feed again since it may loose some of its structure.</remarks>
        public virtual void Normalize()
        {
            if (Constraints.Count != 0)
            {
                Versions = Constraints.Aggregate(Versions ?? new VersionRange(), (current, constraint) => current.Intersect(constraint));
                Constraints.Clear();
            }
        }
コード例 #2
0
        /// <summary>
        /// Handles legacy elements (converts <see cref="Constraints"/> to <see cref="Versions"/>).
        /// </summary>
        /// <exception cref="InvalidDataException">One or more required fields are not set.</exception>
        /// <remarks>This method should be called to prepare a <see cref="Feed"/> for solver processing. Do not call it if you plan on serializing the feed again since it may loose some of its structure.</remarks>
        public virtual void Normalize()
        {
            EnsureNotNull(InterfaceUri, xmlAttribute: "interface", xmlTag: XmlTagName);

            if (Constraints.Count != 0)
            {
                Versions = Constraints.Aggregate(Versions ?? new VersionRange(), (current, constraint) => current.Intersect(constraint));
                Constraints.Clear();
            }
        }
コード例 #3
0
 internal override JsonConstraintResult DoMatch(IJsonValidationContext context, JToken token)
 {
     return(Constraints.Aggregate((JsonConstraintResult)null, (a, b) => a & b.DoMatch(context, token)));
 }