A repository that works with multiple O/R mappers — is it possible?

A recent post on the WilsonORWrapper Google group talked about making WORW multi-database aware by removing static classes and singletons. Well, I’ve kind of been thinking of something similar lately…

For some time I have been toying with the idea of rewriting WORW to support a generic repository service that would work with any O/R mapper, much
like the logger and cache services work over different underlying libraries. By removing the static classes and singletons and adding a provider model for the O/R wrapper element, you would be able to instantiate multiple instances of a “Registry” class, a class which provides a set of services (Repository, Cache, Logger, etc.) based on a given configuration criteira.

As a test I wrote up a simple project (with unit tests!) as a proof-of-concept, using WORM and NPersist as underlying O/R mappers. The WORM part worked fine. The NPersist part almost worked — however, I believe the errors are related to using NPersist’s not-too-well-documented XML provider, not errors with the O/R mapper provider itself (NPersist does initializes properly, which indicates at least something is working right).

If you’re interested in seeing this little stub of a project, download the source (27.5kb). I’ve dubbed it NRepository right now, not for any reason except it’s the first thing that came to mind. Let me know what you think, and whether you think it’s worth pursuing such a project.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>