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