
Untitled
By: a guest on
Aug 6th, 2012 | syntax:
None | size: 0.88 KB | hits: 10 | expires: Never
//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);