Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request [ready to pull]: Ability to define default global DataProvider #33

Open
TheDistantSea opened this issue Oct 6, 2009 · 0 comments

Comments

@TheDistantSea
Copy link
Contributor

Anyone that needs to use SubSonic-generated classes with a programmatically created DataProvider (i.e., multiple databases at once, or databases not defined in the application configuration file as connection strings) has it really tough right now.

The option of using the overloaded constructors and static methods is not viable; there's no way to go and insert another parameter referring to a globally visible DataProvider object in all the SS-related calls in your code base. While technically the feature exists, practically it's unusable.

A much better solution is to take advantage of the fact that all these methods, if not supplied with a DataProvider explicitly, use the default constructor of the DB class that SS generates to get one. Inserting just one property in the generated class and making the default constructor respect it if non-null allows client code to solve the problem with one line of code.

Commit here:
http://github.com/defacer/SubSonic-3.0-Templates/commit/622d42fc4cc7b4562f9b7930bf5c62befe92e6b9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant