public override void DoApplyTransform(XmlFile xmlFile) { FilePath root = xmlFile.Path.Parent; foreach (XmlElement compile in xmlFile.Document.SelectNodes("//x:Compile[@Include]", namespaces)) { string include = compile.GetAttribute("Include"); if (CSharp.IsMatch(include) && !AssemblyInfo.IsMatch(include)) { var filePath = root.File(include); if (File.Exists(filePath.Path)) { var content = filePath.FileContent(); var transformed = standardizer.Standardize(filePath, content); if (transformed == null || content == transformed) { continue; } using (var writer = new StreamWriter(filePath.Path, false)) { writer.Write(transformed); writer.Flush(); } } } } }
public override ValidationResult Validate(ValidationContext <TModel> context) { var standardizedInstance = _standardizer.Standardize(context.InstanceToValidate); var standardizedContext = new ValidationContext <TModel>(standardizedInstance, context.PropertyChain, context.Selector); return(base.Validate(standardizedContext)); }