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)
- {
- }
- }


Nitin SontakkeRank #264 · 9.6K reputationPosted Jun 1, 2018, 9:11 PM EDT
Nitin SontakkeRank #264 · 9.6K reputationPosted Jun 9, 2018, 6:31 PM EDT