Writing an OLE-DB data provider in C#

I am investigating the difficultly in writing an OLE-DB data provider in C#.

Here is a link to the simple OLE-DB provider.

Here is an article on  wsriting custom .net data providers.

I need to start this discussion with a justification of why I would want to do such a thing.

Of late I have been working on a very pure object-oriented project with a design goal of eliminating duplication.

We have a MVC architecture that works fine with all of the business logic being in the Model component.

The problem comes when we get to reporting. We have a requirement to use an external reporting tool. This is the cause of the duplication. As is typical in reporting tools it is oftern easier to code the report as a view than to put too much detail into the reports (this reduces duplication between similar reports).

However this has resulted in calculated fields being defined in both the views and the model. We can always write unit tests to ensure that database calculations matches the model calculations. This results in us loading from views and saving to tables which is far from ideal.

A better approach (which I have used before in a limited form) would be to have the reports run against our model. In order to do this we need to expose our model components as an OLE-DB provider.

Previously I have placed a hook layer between the reporting tool and the database so that I can extend sql with custom commands. This allows the model code (and various common formating objects) to be used from the reports.

This has the benefit of when you change the format of your custom object it is automatically consistent in all of the reports. This is a major time saver on a large project.