Intended to address issue #159, this PR extracts how rethinkdb-net converts expression trees into ReQL terms into a series of externally-implementable interfaces.
This very coarse interface allows for whole-sale replacement of how expression tree to ReQL mapping. It's not very likely that anyone would replace our entire engine for this, though. It's more likely that they'll want to make small changes to our behaviour.
A DefaultExpressionConverterFactory is an implementation of IExpressionConverterFactory that mirrors the existing behaviour. It will also have some extensibility of it's own, so that someone desiring to extend the capabilities of the expression tree conversion doesn't necessarily have to define an entire IExpressionConverterFactory (although that dramatic capability will be available to them). The extensibility in this class will be instance-based (rather than static/global), so it's possible and more likely for a consumer of this library to use one or more specially configured DefaultExpressionConverterFactory for different components of their application.
TODO:
Many of the method call conversions in BaseExpression haven't been reimplemented as plugged-in functionality yet. This results in a lot of tests failing...
DefaultExpressionConverterFactory provided pretty limited extensibility so far; some additional decomposition of it and BaseExpression are probably warranted.
Release note updates.
Consider making an IQueryToTermConverter (or something) that implements both IDatumConverter and IExpressionFactoryConverter, and a delegating implementation of the class. That would eliminate having two arguments to every GenerateTerm method, and if we added additional extensible capabilities they could be incorporated there as well.
Make hard-coded types in Query.cs (eg. Tuple<TLeft, TRight>, DateTimeOffset, double, int) optional. As long as the datum converter can handle it, any type can be used for any return value, so make the obvious options easy but the esoteric options possible.
Intended to address issue #159, this PR extracts how rethinkdb-net converts expression trees into ReQL terms into a series of externally-implementable interfaces.
New interfaces:
This very coarse interface allows for whole-sale replacement of how expression tree to ReQL mapping. It's not very likely that anyone would replace our entire engine for this, though. It's more likely that they'll want to make small changes to our behaviour.
A DefaultExpressionConverterFactory is an implementation of IExpressionConverterFactory that mirrors the existing behaviour. It will also have some extensibility of it's own, so that someone desiring to extend the capabilities of the expression tree conversion doesn't necessarily have to define an entire IExpressionConverterFactory (although that dramatic capability will be available to them). The extensibility in this class will be instance-based (rather than static/global), so it's possible and more likely for a consumer of this library to use one or more specially configured DefaultExpressionConverterFactory for different components of their application.
TODO:
Many of the method call conversions in BaseExpression haven't been reimplemented as plugged-in functionality yet. This results in a lot of tests failing...DefaultExpressionConverterFactory provided pretty limited extensibility so far; some additional decomposition of it and BaseExpression are probably warranted.Release note updates.Consider making an IQueryToTermConverter (or something) that implements both IDatumConverter and IExpressionFactoryConverter, and a delegating implementation of the class. That would eliminate having two arguments to every GenerateTerm method, and if we added additional extensible capabilities they could be incorporated there as well.Make hard-coded types in Query.cs (eg. Tuple<TLeft, TRight>, DateTimeOffset, double, int) optional. As long as the datum converter can handle it, any type can be used for any return value, so make the obvious options easy but the esoteric options possible.