Skip to content

Instantly share code, notes, and snippets.

@sovanesyan
Created March 14, 2012 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sovanesyan/2036680 to your computer and use it in GitHub Desktop.
Save sovanesyan/2036680 to your computer and use it in GitHub Desktop.
Execute OpenAccess validation
//Create a FluentMetadataSource and retrieve the MetadataContainer from it.
Source source = new Source();
MetadataContainer model = source.GetModel();
//We are passing in false in order to specify no resolution actions should be added.
//A resolution action is a proposed by the rule fix for the problem and pops up in the designer.
MetaModelValidation validation = new MetaModelValidation(false);
//Specify the custom validation rule provider
validation.ValidationRuleProvider = new SitefinityValidationProvider();
//You can specify a container that can be used to share additional data in all of the rules.
validation.DataContainer = new StoreDataContainer();
validation.DataContainer.SetData<string>("testString", "testValue");
//Execute the validation specifying we want all of the issues listed.
IValidationResult validationResult = validation.Validate(model, ValidationMode.FindAllErrors);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment