Version 2 has brought some enhancements and changes to the schema modification abilities provided by saucedb. These new features allow you to pick and choose what you want.

For example, lets say you are not comfortable with sauce being able to remove columns. (this is the default starting with 2.1

SqlServerDataStore dstore = new SqlServerDataStore("localhost", "testdb");
dstore.SchemaValidator.CanRemoveColumns = false;

Or you dont want sauce to update columns data types
SqlServerDataStore dstore = new SqlServerDataStore("localhost", "testdb");
dstore.SchemaValidator.CanUpdateColumns = false;

Or you dont want sauce to add columns? ok then
SqlServerDataStore dstore = new SqlServerDataStore("localhost", "testdb");
dstore.SchemaValidator.CanAddColumns = false;

Lets say, you dont want sauce to do anything? We support that also.
SqlServerDataStore dstore = new SqlServerDataStore("localhost", "testdb");
dstore.SchemaValidator = new DoesNothingValidator();

Lastly, we support an option that is a middle road of sorts. Sauce will not modify the schema but it will verify that your data access objects contain match the schema, that is that the required columns are present in the schema.
SqlServerDataStore dstore = new SqlServerDataStore("localhost", "testdb");
dstore.SchemaValidator = new NotifyValidator(dstore);
This option will generate errors with one of the following forms

#"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"

Last edited May 30, 2013 at 3:06 AM by iamkrillin, version 4

Comments

No comments yet.