コード例 #1
0
        public Endpoint()
        {
            DatabaseAdapterFactory factory = new DatabaseAdapterFactory();

            adapters.Add(factory.Create("sqlserver"));
            adapters.Add(factory.Create("oracle"));
        }
コード例 #2
0
        public void Test()
        {
            DatabaseAdapterFactory factory = new DatabaseAdapterFactory();
            IDatabaseAdapter       a       = factory.Create("oracle");
            IDatabaseAdapter       b       = factory.Create("sqlserver");

            b.SetData(a.GetData());
        }
コード例 #3
0
        public Endpoint()
        {
            DatabaseAdapterFactory factory = new DatabaseAdapterFactory();

            adapters.Add(factory.Create("sqlserver"));
            adapters.Add(factory.Create("oracle"));

            // 构造函数部分执行其他Adapter的构造、准备工作的相关任务
        }
コード例 #4
0
        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());
        }
コード例 #5
0
        public void Test1()
        {
            DatabaseAdapterFactory factory = new DatabaseAdapterFactory();
            IDatabaseAdapter       adapter = factory.Create("oracle");

            Assert.AreEqual("oracle", adapter.ProviderName);
            Assert.IsInstanceOf(typeof(OracleAdapter), adapter);
        }