Question

An OleDB provider is a binary implementing COM interfaces provided by Microsoft. From that it seems to be possible to create a provider using C#. Is that correct? Is there a sample demonstrating that? If not, would you discourage me from doing that? I see that there are multiple unmanaged samples but I can't find any managed.

Was it helpful?

Solution

It's way over my head... but here is an interesting Dino Esposito article on the subject at a high level:

http://msdn.microsoft.com/en-us/library/ms810268.aspx

OTHER TIPS

The article is good, but doesn't actually answer the question. OLEDB is a set of COM interfaces that could in fact be implemented in .Net via COM Interop though I've never heard of such an implementation and probably isn't advisable.

The set of OLEDB interfaces are documented by Microsoft here. OLEDB is a complicated topic and not all interfaces are required to implement a functional provider. To make things worse, different OLEDB clients have the set of interfaces they require to be able to use the provider. For example, here is a list of require interfaces that must be implemented to use a provider from the .Net OLEDB client (System.Data.OleDb.*). Note: I didn't find such a link for the 2.0 Framework or later. Finally it's worth noting that it was so difficult to implement providers Microsoft later provided a set of ATL templates (C++) to help implementers do it correctly.

To learn more about OLEDB I'd definitely recommend looking at the Windows Data Access SDK on MSDN.

I am not sure I really understand your question?! There already is a managed OleDBProvider?!

using System.Data.OleDb;

I would certainly discourage writing a provider that exists and works absolutely fine! :)

But in answer to your first question, you can of course create your own. The Data Provider Roadmap may be a good place to start for an overview and links to samples etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top