public Endpoint() { DatabaseAdapterFactory factory = new DatabaseAdapterFactory(); adapters.Add(factory.Create("sqlserver")); adapters.Add(factory.Create("oracle")); }
public void Test() { DatabaseAdapterFactory factory = new DatabaseAdapterFactory(); IDatabaseAdapter a = factory.Create("oracle"); IDatabaseAdapter b = factory.Create("sqlserver"); b.SetData(a.GetData()); }
public Endpoint() { DatabaseAdapterFactory factory = new DatabaseAdapterFactory(); adapters.Add(factory.Create("sqlserver")); adapters.Add(factory.Create("oracle")); // 构造函数部分执行其他Adapter的构造、准备工作的相关任务 }
public void Test() { DatabaseAdapterFactory factory = new DatabaseAdapterFactory(); IDatabaseAdapter adapter = factory.Create("oracle"); Assert.AreEqual <string>("oracle", adapter.ProviderName); Assert.AreEqual <Type>(typeof(OracleAdapter), adapter.GetType()); }
public void Test1() { DatabaseAdapterFactory factory = new DatabaseAdapterFactory(); IDatabaseAdapter adapter = factory.Create("oracle"); Assert.AreEqual("oracle", adapter.ProviderName); Assert.IsInstanceOf(typeof(OracleAdapter), adapter); }