[.NET 2.0] Writing Your Own Provider

Being intrigued by the provider system, I though I would spend some time on the excellent Provider Toolkit page on MSDN to see if I could understand how to write your own provider. From scratch that is, not based on the membership stuff.

I found this great page, which describes how to write an SqlImageProvider from ground up. The sample code on the page got some errors in it, but I got it working eventually, and it's just amazing. I'll write another really simple provider and post the code here soon.

I'm thinking what I could use the provider system for... perhaps if you wanted to construct a system where you know you would start using Access or even XML files, then at a later state move to SQL or Oracle. You could write the whole interface to your DAL as a provider... perhaps a bit too much code to be funny, but it could work. Each method would have to be written at least three times - once for the base, once for the service and of course once for the concrete provider where you would probably use whatever helper classes you got to actually manage the data. Oh well...

No Comments