示例#1
0
        /// <summary>
        ///     Set Update Constraints.
        /// </summary>
        /// <param name="valueAction">
        ///     An action to create the <see cref="ThreatListUpdateConstraints" /> to apply when the
        ///     <see cref="ThreatList" /> is retrieved.
        /// </param>
        /// <returns>
        ///     This threat list update query builder.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">
        ///     Thrown if <paramref name="valueAction" /> is a null reference.
        /// </exception>
        public ThreatListUpdateQueryBuilder SetUpdateConstraints(Func <ThreatListUpdateConstraintsBuilder, ThreatListUpdateConstraints> valueAction)
        {
            Guard.ThrowIf(nameof(valueAction), valueAction).Null();

            // ...
            //
            // Throws an exception if the operation fails.
            var threatListUpdateConstraintsBuilder = ThreatListUpdateConstraints.Build();
            var threatListUpdateConstraints        = valueAction(threatListUpdateConstraintsBuilder);

            this.SetUpdateConstraints(threatListUpdateConstraints);

            return(this);
        }
        /// <summary>
        ///     Create a Threat List Update Constraints.
        /// </summary>
        static ThreatListUpdateConstraints()
        {
            ThreatListUpdateConstraints.Default = CreateDefault();

            // <summary>
            //      Create Default Threat List Update Constraints.
            // </summary>
            ThreatListUpdateConstraints CreateDefault()
            {
                var cThreatListUpdateConstraints = ThreatListUpdateConstraints.Build()
                                                   .SetThreatListLocation(null)
                                                   .SetClientLocation(null)
                                                   .SetMaximumDatabaseEntries(0)
                                                   .SetMaximumResponseEntries(0)
                                                   .SetThreatListLanguage(null)
                                                   .Build();

                return(cThreatListUpdateConstraints);
            }
        }