Esempio n. 1
0
        /************************************************************************************************************************/

        internal void Init(IDbConnection conn)
        {
            //
            if (XConfig.DB == DbEnum.None)
            {
                if (XConfig.MySQL.Equals(conn.GetType().FullName, StringComparison.OrdinalIgnoreCase))
                {
                    XConfig.DB = DbEnum.MySQL;
                }
                else
                {
                    throw new Exception("MyDAL 目前只支持 【MySQL】,后续将会支持【Oracle/SQLServer/PostgreSQL/DB2/Access/SQLite/Teradata/MariaDB】.");
                }
            }

            //
            Conn       = conn;
            Parameters = new List <DicParam>();
            AH         = new AttributeHelper(this);
            VH         = new CsValueHelper(this);
            GH         = new GenericHelper(this);
            EH         = new XExpression(this);
            SC         = new XCache(this);
            PH         = new ParameterHelper(this);
            DPH        = new DicParamHelper(this);
            BDH        = new BatchDataHelper();
            DS         = new DataSource(this);

            //
            if (XConfig.DB == DbEnum.MySQL)
            {
                SqlProvider = new MySqlProvider(this);
            }
        }
Esempio n. 2
0
        /************************************************************************************************************************/

        internal void Init(XConnection xConn)
        {
            //
            if (XConfig.ConnTypes.TryGetValue(xConn.Conn.GetType().FullName, out var db))
            {
                DB = db;
            }
            else
            {
                throw XConfig.EC.Exception(XConfig.EC._043, "MyDAL 只支持【MySQL】.");
            }

            //
            XConn      = xConn;
            Parameters = new List <DicParam>();
            AH         = new AttributeHelper(this);
            VH         = new CsValueHelper(this);
            GH         = new GenericHelper(this);
            XE         = new XExpression(this);
            CFH        = new CsFuncHelper(this);
            TSH        = new ToStringHelper(this);
            XC         = new XCache(this);
            PH         = new ParameterHelper(this);
            DPH        = new DicParamHelper(this);
            BDH        = new BatchDataHelper();
            TbMs       = new List <TableDic>();

            //
            SqlProvider = new MySqlProvider(this);
        }
Esempio n. 3
0
        /************************************************************************************************************************/

        internal void Init(XConnection xConn)
        {
            //
            if (XConfig.ConnTypes.TryGetValue(xConn.Conn.GetType().FullName, out var db))
            {
                DB = db;
            }
            else
            {
                throw XConfig.EC.Exception(XConfig.EC._043, "MyDAL 目前只支持【MySQL/SQLServer】,后续将会支持【Oracle/PostgreSQL/DB2/Access/SQLite/Teradata/MariaDB】.");
            }

            //
            XConn      = xConn;
            Parameters = new List <DicParam>();
            AH         = new AttributeHelper(this);
            VH         = new CsValueHelper(this);
            GH         = new GenericHelper(this);
            XE         = new XExpression(this);
            CFH        = new CsFuncHelper(this);
            TSH        = new ToStringHelper(this);
            XC         = new XCache(this);
            PH         = new ParameterHelper(this);
            DPH        = new DicParamHelper(this);
            BDH        = new BatchDataHelper();
            TbMs       = new List <TableDic>();

            //
            if (XConfig.DbProviders.TryGetValue(DB, out var func))
            {
                SqlProvider = func(this);
            }
        }