Skip navigation

I have done some terrible, terrible things over the past few months in my dealings with RavenDB. This one isn’t so bad.

Optimash Prime

I noticed early on that I was probably going to have to write a few Transformers. I’m lazy and didn’t want to have to actually¬†do¬†anything to maintain them or make sure they’re up-to-date if I change the underlying codebase, so I came up with a way to have it take care of itself for me.

This chunk of code is intended to be run just after you’ve initialized your static IDocumentStore, preferably in a web service or something that isn’t going to be starting and stopping a whole lot. The point is that this ought to happen infrequently, hopefully only once.

Pretty simple stuff. Get all the classes you’ve created which inherit from AbstractTransformerCreationTask, initialize one of each, convert all those instances to a list, and then dump each one into the IDocumentStore. Now the Transformers in the database are guaranteed to match their counterparts from your codebase.