schambers/fluentmigrator — pull request #310 by ibebbs (2012-09-26 14:17:53+00:00)
Title: Defer DataDefinition evaluation until SQL Generation

Previously, InsertDataDefinition and DeleteDataDefinition recorded explicit values (as KeyValuePair instances) which could not be (easily) parsed or modified at the generation stage.

This commit provides a ReflectedDataDefinition to hold a reference to the anonymously typed object containing the data to insert/delete. This ReflectedDataDefinition is then evaluated into a collection of IDataValue (replacing the KeyValuePair) instances by an IEvaluator. Each generator now takes an IEvaluator as a constructor parameter (in a similar way to the IColumn and IQuoter parameters) and a GenericEvaluator is provided for all Generator types.

An ExplicitDataDefinition is provided to pass specific IDataValue instances when reflection over an anonymous type is not required/desired (used extensively in tests).

IDataValue contains (string) ColumnName, (object) Value and (bool) QuoteValue properties, the last of which, when false, prevents the Value from being quoted (i.e. for instances where the value is function call or constant).

Finally a derived MySqlEvaluator is provided which allows the MySqlGenerator to construct a SQL statement capable of inserting binary data (via hex encoding and use if the MySql UNHEX function).

FluentMigrator.Console.csproj and FluentMigrator.Runner.csproj have been changed to target .Net 4.0 purely as that's the framework I'm using; no 4.0 dependencies have been introduced.

BREAKING CHANGES:

Several of the undo functions in the Firebird Generator/Runner have been commented out as, to be honest, I couldn't work out what they were trying to do. Should be possible for the developer responsible for this RDBMS to easily fix up the code to a functional state again.

Integration tests have been marked with [Category("Integration")] so that they can be omitted from local test runs. All non-integration tests passing successfully.