If i make change in IDatabase interface then it will affect, and at run while creating object of CustomerRepository we still worry about what i have to pass for constructor parameter, Does that mean still there is tight coupling for classes over interface ?
- class CustomerRepository
- {
- private readonly IDatabase database;
- public CustomerRepository(IDatabase database)
- {
- this.database = database;
- }
- public void Add(string CustomerName)
- {
- database.AddRow("Customer", CustomerName);
- }
- }
- interface IDatabase
- {
- void AddRow(string Table, string Value);
- }
- class Database : IDatabase
- {
- public void AddRow(string Table, string Value)
- {
- }
- }
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Nitin SontakkePosted Jun 2, 2018, 1:11 AM
Nitin SontakkePosted Jun 9, 2018, 10:31 PM