Just making sure this is correct. By this I mean PreCode (requires Windows Live Writer 2009) with SyntaxHighligher setup. PreCode is also a stand alone program.
public bool Validate(IValidationDictionary modelState, string prefix)
{
// xVal example code
var dataAnnotationErrors = from prop in TypeDescriptor.GetProperties(_entity).Cast<PropertyDescriptor>()
from attribute in prop.Attributes.OfType<ValidationAttribute>()
where !attribute.IsValid(prop.GetValue(_entity))
select new ErrorInfo(prop.Name, attribute.FormatErrorMessage(string.Empty), _entity);
var brokenRules = GetBrokenRules();
if (!String.IsNullOrEmpty(prefix))
prefix += ".";
if (dataAnnotationErrors.Any())
dataAnnotationErrors.ForEach(ei => modelState.AddError(prefix + ei.PropertyName, ei.ErrorMessage));
if (brokenRules.Any())
brokenRules.ForEach(rule => modelState.AddError(prefix + rule.Property, rule.Message));
return modelState.IsValid;
}
There is a “Fix Indentation” button in PreCode. I am in love.
Now just to setup the clipboard SWF thing.
I should seriously consider a theme with a wider content area.