Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Making a Class Globally Available

$
0
0
So this is something I'm having some trouble with. Obviously, I'm missing something.

The program I'm building is going to interact with a database on just about every form. I've built a Facade to simplify this, and a Proxy to access the Facade. The reason is that we're currently using an Access Database but plan to move to using MSSQL. The goal is to make the transition as code-lite as possible.

So there is AccessFacade, and DatabaseProxy. The idea is that when we switch to SQL I'll just write an SQLFacade and change the Type in the DatabaseProxy. I want to implement this class in such a way that I only need to instantiate it once, or better can make it accessible to the entire program.

I'm thinking there should be a way to set it up so that I can access it by doing, say:

Dim data as New DataSet = DatabaseProxy.DoQuery("SELECT * FROM DateProspects WHERE prospectID = 'Your Mom'")


Is this just bad design, am I barking up the wrong tree, or is there a way to set this up that I'm just not finding?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>