Breaking SOLID Principles in multiple implementation of an Interface
问题 I am facing a problem with dependency inversion in a factory method and it is also breaking Open Closed principle. My code looks like below codes public interface IWriter { void WriteToStorage(string data); } public class FileWriter : IWriter { public void WriteToStorage(string data) { //write to file } } public class DBWriter : IWriter { public void WriteToStorage(string data) { //write to DB } } Now I an using a factory class to solve the object creation. It look like below code public