Пример #1
0
        public void OracleTest()
        {
            //Data Source=XE;User ID=hr;Unicode=True
            IDbProvider dbProvider = DbProviderFactory.GetDbProvider("System.Data.OracleClient");
            dbProvider.ConnectionString = "Data Source=XE;User ID=hr;Password=hr;Unicode=True";
            AdoTemplate adoTemplate = new AdoTemplate(dbProvider);
            decimal count = (decimal) adoTemplate.ExecuteScalar(CommandType.Text, "select count(*) from emp");
            Assert.AreEqual(14, count);

            EmpProc empProc = new EmpProc(dbProvider);
            IDictionary dict = empProc.GetEmployees();
            foreach (DictionaryEntry entry in dict)
            {
                Console.WriteLine("Key = " + entry.Key + ", Value = " + entry.Value);
            }
            IList employeeList = dict["employees"] as IList;
            foreach (Employee employee in employeeList)
            {
                Console.WriteLine(employee);
            }
        }