public DbConfiguration_Factory()
        {
            //获取配置文件

            IWriteSQLConfigValue _write = new IniFileWriter(SG.Parameters.SGParameter.sAppPath + INI_CFG_PATH);
            _dbType= _write.DbType;
        }
        public DbConfiguration_Factory()
        {
            //获取配置文件

            IWriteSQLConfigValue _write = new IniFileWriter(SG.Parameters.SGParameter.sAppPath + INI_CFG_PATH);

            _dbType = _write.DbType;
        }
Exemplo n.º 3
0
 /// <summary>
 /// 加载连接配置
 /// </summary>
 /// <param name="ConfigFile">配置文件</param>
 public static void LoadConfiguration(string ConfigFile)
 {
     if (File.Exists(ConfigFile))
     {
         IWriteSQLConfigValue cfg = new IniFileWriter(ConfigFile);
         new SqlConfiguration().SetSQLConfig(cfg);
     }
     else
     {
         throw new Exception("Program cann't run without a BdConfiguration.You should config the SQL connection by running CSFramework.Tools.SqlConnector.exe!");
     }
 }
        /// <summary>
        /// 获取帐套管理数据库连接串
        /// </summary>
        /// <returns></returns>
        public static string GetAccountConnString()
        {
            string sConn             = "";
            IWriteSQLConfigValue cfg = new IniFileWriter(SG.Parameters.SGParameter.sAppPath + INI_CFG_PATH);

            if (cfg.DbType == DbAcessTyp.SQLServer)
            {
                sConn = new SqlConfiguration().GetConnectionString(cfg);
            }
            else if (cfg.DbType == DbAcessTyp.Oracle)
            {
                sConn = new OraConfiguration().GetConnectionString(cfg);
            }

            return(sConn);
        }
        /// <summary>
        /// 获取帐套管理数据库连接串
        /// </summary>
        /// <returns></returns>
        public static string GetAccountConnString()
        {
            string sConn = "";
            IWriteSQLConfigValue cfg = new IniFileWriter(SG.Parameters.SGParameter.sAppPath + INI_CFG_PATH);
            if(cfg.DbType==DbAcessTyp.SQLServer)
            {
                sConn = new SqlConfiguration().GetConnectionString(cfg);
            }
            else if(cfg.DbType==DbAcessTyp.Oracle)
            {
                sConn = new OraConfiguration().GetConnectionString(cfg);
            }

            return sConn;
        }
Exemplo n.º 6
0
 /// <summary>
 /// 加载连接配置
 /// </summary>
 /// <param name="ConfigFile">配置文件</param>
 public static void LoadConfiguration(string ConfigFile)
 {
     if (File.Exists(ConfigFile))
     {
         IWriteSQLConfigValue cfg = new IniFileWriter(ConfigFile);
         new SqlConfiguration().SetSQLConfig(cfg);
     }
     else
         throw new Exception("Program cann't run without a BdConfiguration.You should config the SQL connection by running CSFramework.Tools.SqlConnector.exe!");
 }
Exemplo n.º 7
0
        /// <summary>
        /// 初始化桥接功能
        /// </summary>
        public static bool InitializeBridge()
        {
            bool connected = false;

            try
            {
                //ADODirect方式,从INI文件读配置信息
                if (BridgeType.ADODirect == BridgeType)
                {
                    //获取连接配置.支持4种连接配置:1.INI, 2.注册表 3.SQLExpress INI 4.Web.Config
                    //IWriteSQLConfigValue cfgRegistry = new RegisterWriter(SqlConfiguration.REG_SQL_CFG);

                    //开发环境,直接从INI文件读取SQL连接配置
                    //IWriteSQLConfigValue cfgSQLExpress = new SQLExpressCfg(Application.StartupPath + @"\CSFramework.ini");

                    //生产环境连接配置
                    IWriteSQLConfigValue cfgNormal = new IniFileWriter(Application.StartupPath + DbConfiguration_Factory.INI_CFG_PATH);

                    //设置配置信息
                    //SqlConfiguration.SetSQLConfig(cfgNormal);
                    DbConfiguration_Factory.SetSQLConfig(cfgNormal);
                    connected = TestADOConnection();//测试AdoDirect连接
                }

                if (BridgeType.WebService == BridgeType)
                {
                    //初始化服务端的SQL连接
                    connected = TestWebServiceConnection();//测试WebService连接
                }

                if (BridgeType.WcfHost == BridgeType)
                {
                    //初始化服务端SQL连接
                    connected = TestWcfHostConnection();//测试WebService连接
                }
            }
            catch (Exception ex)
            {
                Msg.ShowException(ex);
            }

            //测试桥接是否成功
            if (false == connected)
            {
                Msg.Warning(TEST_BRIDGE_FAILED + "\r\n\r\nBridgeType:" + BridgeFactory.BridgeType.ToString());
            }

            return connected;
        }