Bind a connectionString to every DataProvider constructor OR inject a connection interface
My Services are all accessing DataProvider classes. Each DataProvider constructor gets the connectionString as parameter injected with a DI tool.
Where is the advantage of hiding the connectionString in a IConnectionString interface and inject this interface instead of the connectionString?
Just consider for your answer: I do not use any interface to access my DataProvider classes. And these classes do not use IDbConnection.
I completely tie myself to the MS SQL Server and this is what I want :)
Injection is not only because of replacability. Its much more about testability.
If you are tied 100% to SQL Server then your tests would also be bound to Sql Server and thats not very good and makes things complicated.
If you don't use any interfaces for your dataprovider, than using interfaces fo connectionstrings would bring any benefits from my point of view.
The idea of injecting components is the depedency injection principle. s. also Martin Fowlers Post
But even if you will ever use MS SQl Server I would strongly recommend using some kind of Gateway / Repository pattern. That would give you such a better test experience and more reliable software.
As a refrence i can suggest you the cleancoders webcasts from uncle bob (Robert C Martin