It took me a LOOOOONG while (first announcement a year ago), but there it is : the long-awaited ADO.NET provider for Bamboo Object Prevalence engine is finally available, under an Open Source license of course, on GitHub :
Object prevalence is an old concept that has recently reborn with the NoSQL approaches. As the drawbacks of tabulated storage are more and more recognized, the NoSQL movement proposes new way to persist data in a format that is closer to the way it is used in memory. Sometimes, these solutions even store the data in memory, at least temporarily.
Object prevalence goes to the extreme of the concept, by establishing the in-memory object-oriented model as the persistence model. Thus, there is no ORM and no conversion whatsoever when using a prevalence engine. The persistence to disk, which is necessary to spare the data of a power failure for example, is done by the engine, in a way that is transparent to the programmer. The developer only manages commands and queries on the model, which makes object prevalence a good choice for CQRS architectures.
One of the limits of object prevalence (and generally-speaking NoSQL solutions) is that it forces to abandon the SQL legacy requests. Sometimes, this accounts for a fair amount of intelligence and can slow down, or even hinder, the migration to object prevalence, despite the huge advantages in performance as well as code-writing ease and robustness.
The goal of this project is to bridge the gap and allow for a progressive migration by providing an ADO.NET provider for Bamboo.Prevalence, which allows to access prevalent data by using legacy SQL, once a mapping is established between the data in memory and the names of the fields and tables in the SQL requests.
The way it works is simple and complicated at the same time. In theory, one only has to decompose the SQL, and then construct a Linq syntax to execute the corresponding request against the objects managed by the prevalence engine. In practice, though… this means dynamically constructing a lambda expression. And this… is much more complicated. Let’s see what we have here :
- one level of indirection between SQL and the model
- another between SQL and the composed request tree
- another one between the tree and the Linq request
- a fourth one between Where or Having and the lambda expression
- a fifth between compiled lambda and its memory representation
- a final one between the memory representation and the .NET Expressions API
This complexité has worn out two interns before finding the right one, namely Damien Gaillard, who did an excellent job implementing this architecture. The code has only been modified a little to be published on GitHub (English version, comments rewriting, different classes structure), and some parts are missing like Group By, Having, etc. I will add them later on, the essential being that the principles of the provider are exposed to anybody’s comments. Even if you do not understand the principle of an ADO.NET provider for Bamboo, please do not hesitate in casting an eye to the code. All constructive comments are welcome !
I hope this little project will help Object Prevalence adoption, by easing migration from heavy SQL legacy application, and that it will also give some people good ideas about dynamic programming. About this particular point, by the way, a next version based on Roslyn is bound to happen some day, but I dare not announce a date, since it already took me a year to publish this first version