public void Execute() { templateFinder = new ValidationTemplateFinder { LogInfo = LogInfo, ModuleDefinition = ModuleDefinition, }; templateFinder.Execute(); dataErrorInfoFinder = new DataErrorInfoFinder { ValidationTemplateFinder = templateFinder, ModuleDefinition = ModuleDefinition, }; dataErrorInfoFinder.Execute(); notifyDataErrorInfoFinder = new NotifyDataErrorInfoFinder { ValidationTemplateFinder = templateFinder, ModuleDefinition = ModuleDefinition, }; notifyDataErrorInfoFinder.Execute(); if (!dataErrorInfoFinder.Found && !notifyDataErrorInfoFinder.Found) { throw new WeavingException("Found ValidationTemplate but it did not implement INotifyDataErrorInfo or IDataErrorInfo"); } ProcessTypes(); RemoveReference(); }
public void Execute() { var allTypes = ModuleDefinition.GetTypes().Where(x => x.IsClass).ToList(); try { templateFinder = new ValidationTemplateFinder { AllTypes = allTypes, ModuleDefinition = ModuleDefinition }; templateFinder.Execute(); } catch (WeavingException) { var refTypes = GetTypesFromAttributeAssembly(allTypes); templateFinder = new ValidationTemplateFinder { AllTypes = refTypes, ModuleDefinition = ModuleDefinition }; templateFinder.Execute(); } dataErrorInfoFinder = new DataErrorInfoFinder { ValidationTemplateFinder = templateFinder, ModuleDefinition = ModuleDefinition, }; dataErrorInfoFinder.Execute(); notifyDataErrorInfoFinder = new NotifyDataErrorInfoFinder { ValidationTemplateFinder = templateFinder, ModuleDefinition = ModuleDefinition, }; notifyDataErrorInfoFinder.Execute(); if (!dataErrorInfoFinder.Found && !notifyDataErrorInfoFinder.Found) { throw new WeavingException("Found ValidationTemplate but it did not implement INotifyDataErrorInfo or IDataErrorInfo"); } ProcessTypes(allTypes); RemoveReference(); }