Schema Validation
Sauce ships with 4 different schema validators.The default is the "ModifyValidator"
Modify Validator
This validator will modify the underlying database structure to match your data models.In order to use it, just create your datastore and pass objects to it.
This validator knows how to...
- Add tables
- Add schemas
- Remove Columns (This is disabled by default)
- Add Columns
- Modify Columns
Notify Validator
This validator will make zero changes to the underlying datastore,but it will read the schema data and verify that the object mathes the datastore.
If this fails an error or the following type will be generated
- A Table {0} was requested but was not found in the datastore
- A column ({0}) was requested on table {1} by object type {2}, however, it is not present in the datastore
- The view {0} is missing the following columns {1}
- The view requested by {0} ({1}) was not found
Does Nothing Validator
As the name implies, this validator will do nothing.Change Validators
In order to change the validators just specify it after you create your datastore.IDataStore dstore;
//create store
dstore.SchemaValidator = new DoesNothingValidator();
dstore.SchemaValidator = new NotifyValidator(dStore);
Validation Options
You can also change up how the validators are allowed to behaveIDataStore dstore;
//create store
dstore.SchemaValidator.CanAddColumns = false;
dstore.SchemaValidator.CanRemoveColumns = false;
dstore.SchemaValidator.CanUpdateColumns = false;