/// <summary>
        /// Evaluates the violations for the rule.
        /// </summary>
        /// <remarks></remarks>
        public override IEnumerable<ValidationResult> Validate()
        {
            List<ValidationResult> errors = new List<ValidationResult>();

            // Verify all [Required] and [Import]ed properties have valid values.
            this.ValidateObject();

            // Make initial trace statement for this rule
            tracer.Info(
                "Validating $safeitemname$ on current element '{0}' with AProperty '{1}'", this.CurrentElement.InstanceName, this.AProperty);

            // TODO: Implement provider automation code to determine the violations
            errors.Add(new ValidationResult(
                string.Format(CultureInfo.CurrentCulture,
                "The element '{0}' is not valid in some way. <Some prescriptive action to make it valid.>",
                this.CurrentElement.InstanceName)));

            // TODO: Use tracer.Warn() to note expected and recoverable errors
            // TODO: Use tracer.Verbose() to note internal execution logic decisions
            // TODO: Use tracer.Info() to note key results of execution
            // TODO: Raise exceptions for all other errors

            tracer.Info(
                "Validated $safeitemname$ on current element '{0}' with AProperty '{1}', as '{2}'", this.CurrentElement.InstanceName, this.AProperty, !errors.Any());

            return errors;
        }
示例#2
0
        /// <summary>
        /// Returns the list of string values for the enumeration
        /// </summary>
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            var items = new List<string>();

            try
            {
                // Make initial trace statement for this converter
                tracer.Info(
                    "Determining values for this converter");

                // TODO: Implement code to fetch or calculate the returned values.
                items.Add("One");
                items.Add("Two");
                items.Add("Three");

                // TOOD: If you want a dynamic list of values from somewhere your pattern model,
                // you can cast the 'context' parameter to be the type of the 
                // owning element of the property where the this converter is configured 
                // to gain access to the instances of elements your pattern model.
                // var currentElement = context.Instance as IProductElement;
                // var variableElement1 = currentElement.As<IVariableElement1>();


                // TODO: Use tracer.Warn() to note expected and recoverable errors
                // TODO: Use tracer.Verbose() to note internal execution logic decisions
                // TODO: Use tracer.Info() to note key results of execution
                // TODO: Raise exceptions for all other errors

                return new StandardValuesCollection(items);
            }
            catch (YourExpectedException ex)
            {
                // TODO: Only catch expected exceptions that you can handle, and trace them before re-throwing.
                // TODO: Remove this 'catch' if no expections are expected
                tracer.Error(
                    ex, "Some error calculating or fetching values");

                throw;
            }
        }
 public List$fileinputname$sResponse(List<$fileinputname$Summary> $fileinputname$s)
示例#4
0
 public List$fileinputname$sResponse List$fileinputname$s(List$fileinputname$sRequest request)