mardi 23 juin 2015

nuget package - switching between test/live settings

A question about structure really. I have a class library which, amongst other functionality, also runs some database bits.

If I turn this into a nuget package so others in the company that need it can pull it down into their solutions, how do they go about changing the settings from test to live settings? (e.g. connection strings).

Is there a way to do this or is this bad design in general? For instance, should I actually be loading in the repository separately as opposed to having it as art of the pack?

At current workflow goes like this

Instantiate classes > 
Call method - method takes a record id >
Method calls repository and gets record from the id >
....does stuff to record... >
Method saves amendments back to database.

Should it instead be doing something like

Instantiate classes >
**Load repository into class** >
Call method - method takes a record id >
Method calls repository and gets record from the id >
....does stuff to record... >
Method saves amendments back to database.

Or should I not be handling any database access at all in the package, in which case how best to handle this whilst keeping my code reusable?

Thanks

Aucun commentaire:

Enregistrer un commentaire