Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 6th, 2012  |  syntax: None  |  size: 0.88 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //Create a FluentMetadataSource and retrieve the MetadataContainer from it.
  2. Source source = new Source();
  3. MetadataContainer model = source.GetModel();
  4.  
  5. //We are passing in false in order to specify no resolution actions should be added.
  6. //A resolution action is a proposed by the rule fix for the problem and pops up in the designer.
  7. MetaModelValidation validation = new MetaModelValidation(false);
  8.  
  9. //Specify the custom validation rule provider
  10. validation.ValidationRuleProvider = new SitefinityValidationProvider();
  11.  
  12. //You can specify a container that can be used to share additional data in all of the rules.
  13. validation.DataContainer = new StoreDataContainer();
  14. validation.DataContainer.SetData<string>("testString", "testValue");
  15.  
  16. //Execute the validation specifying we want all of the issues listed.
  17. IValidationResult validationResult = validation.Validate(model, ValidationMode.FindAllErrors);