1

In the SOA architecture, with many services that implements data persistence as well as basic logic - is there even a place for connection strings in client Desktop applications? Or should everything goes through the service?

Does it change for Microservices?

1 Answer 1

1

In my experience, connection strings are only required in the layers that connect directly to the database. From a SOLID standpoint, connection strings should be somewhere that is keenly specific to connecting to the database, perhaps a property on an IDatabaseConnection implementation, loaded from a config file for easy switching.

You are, however, perfectly allowed to have multiple services, and passing parameters to methods on those services is perfectly allowed also. Thus, passing a value for which database to connect to is fine (if a little dirty), but I'd at least make it an additional abstraction of the connection string, for example just the name of it rather than the full string.

Another architecture may be to have two data-services dedicated to retrieving data from each of the databases, and another service to serve the clients with that data in the format they expect.

As for microservices, it's the same principles really apart from the services are separated out even more.

I'd also consider it a security risk to include connection strings on any clients, it has machine names, passwords, usernames, all sorts in there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.