class Program { static void Main(string[] args) { Dal dal = new MySql(); dal.Add(); Dal dal1 = new SqlServer(); dal1.Add(); Console.ReadKey(); } } interface Dal { void Add(); } class MySql : Dal { public void Add() …
Inversion of Control Containers and the Dependency Injection pattern --Martin Fowler 本文内容 Component and Service(组件和服务) A Naive Example(一个超级简单的例子) Inversion of Control(控制反转) Forms of Dependency Injection(依赖注入的几种形式) Constructor Injection with PicoConta…