Пример #1
0
        private void btnOracle_Click(object sender, EventArgs e)
        {
            AccessDBEngine objCustomer = new AccessDBEngine();

            //objCustomer.setDatabase(new clsSQLServer());
            objCustomer.setDatabase(new clsOracle());
            objCustomer.save();
        }
Пример #2
0
        private void btnSQLServer_Click(object sender, EventArgs e)
        {
            var config   = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
            var settings = config.GetSection("DatabaseSouces") as AppSettingsSection;

            AccessDBEngine objCustomer = new AccessDBEngine();
            var            instance    = Activator.CreateInstance(Type.GetType(settings.Settings["database"].Value));

            //var instance = Activator.CreateInstance(Type.GetType("IoCPattern.clsSQLServer,IoCPattern"));
            objCustomer.setDatabase((iDatabase)instance);
            objCustomer.save();
        }