Ejemplo n.º 1
0
        private static void CheckDbDependency(ConnectionConfig config)
        {
            switch (config.DbType)
            {
            case DbType.MySql:
                DependencyManagement.TryMySqlData();
                break;

            case DbType.SqlServer:
                break;

            case DbType.Sqlite:
                DependencyManagement.TrySqlite();
                break;

            case DbType.Oracle:
                DependencyManagement.TryOracle();
                break;

            case DbType.PostgreSQL:
                DependencyManagement.TryPostgreSQL();
                break;

            case DbType.Kdbndp:
                DependencyManagement.TryKdbndb();
                break;

            case DbType.Dm:
                DependencyManagement.TryDm();
                break;

            default:
                throw new Exception("ConnectionConfig.DbType is null");
            }
        }
Ejemplo n.º 2
0
        public SqlSugarClient(ConnectionConfig config)
        {
            base.Context = this;
            base.CurrentConnectionConfig = config;
            Check.ArgumentNullException(config, "config is null");
            switch (config.DbType)
            {
            case DbType.MySql:
                DependencyManagement.TryMySqlData();
                break;

            case DbType.SqlServer:
                break;

            case DbType.Sqlite:
                DependencyManagement.TrySqlite();
                break;

            case DbType.Oracle:
                //throw new Exception("Oracle developed 75%,to be continued");
                break;

            default:
                throw new Exception("ConnectionConfig.DbType is null");
            }
        }
Ejemplo n.º 3
0
        public SqlSugarClient(ConnectionConfig config)
        {
            base.Context = this;
            base.CurrentConnectionConfig = config;
            base.ContextID = Guid.NewGuid();
            Check.ArgumentNullException(config, "config is null");
            switch (config.DbType)
            {
            case DbType.MySql:
                DependencyManagement.TryMySqlData();
                break;

            case DbType.SqlServer:
                break;

            case DbType.Sqlite:
                DependencyManagement.TrySqlite();
                break;

            case DbType.Oracle:
                DependencyManagement.TryOracle();
                break;

            case DbType.PostgreSQL:
                throw new Exception("Development 50%");

            default:
                throw new Exception("ConnectionConfig.DbType is null");
            }
        }
Ejemplo n.º 4
0
        public SqlSugarClient(ConnectionConfig config)
        {
            this.Context = this;
            this.CurrentConnectionConfig = config;
            this.ContextID = Guid.NewGuid();

            Console.WriteLine("sqlid:" + this.ContextID);

            Check.ArgumentNullException(config, "config is null");
            switch (config.DbType)
            {
            case DbType.MySql:
                DependencyManagement.TryMySqlData();
                break;

            case DbType.SqlServer:
                break;

            case DbType.Sqlite:
                DependencyManagement.TrySqlite();
                break;

            case DbType.Oracle:
                DependencyManagement.TryOracle();
                break;

            case DbType.PostgreSQL:
                DependencyManagement.TryPostgreSQL();
                break;

            default:
                throw new Exception("ConnectionConfig.DbType is null");
            }
        }
Ejemplo n.º 5
0
        private static void CheckDbDependency(ConnectionConfig config)
        {
            switch (config.DbType)
            {
            case DbType.MySql:
                DependencyManagement.TryMySqlData();
                break;

            case DbType.SqlServer:
                break;

            case DbType.Sqlite:
                DependencyManagement.TrySqlite();
                break;

            case DbType.Oracle:
                DependencyManagement.TryOracle();
                break;

            case DbType.PostgreSQL:
                DependencyManagement.TryPostgreSQL();
                break;

            case DbType.Kdbndp:
                DependencyManagement.TryKdbndb();
                break;

            case DbType.Dm:
                DependencyManagement.TryDm();
                break;

            case DbType.Oscar:
                DependencyManagement.TryOscar();
                break;

            case DbType.MySqlConnector:
                InstanceFactory.CustomDllName = SugarCompatible.IsFramework?"SqlSugar.MySqlConnector": "SqlSugar.MySqlConnectorCore";
                break;

            case DbType.Access:
                InstanceFactory.CustomDllName = SugarCompatible.IsFramework?"SqlSugar.Access": "SqlSugar.AccessCore";
                break;

            case DbType.Custom:
                Check.Exception(InstanceFactory.CustomDbName.IsNullOrEmpty(), "DbType.Custom: InstanceFactory.CustomDbName is not null  ");
                Check.Exception(InstanceFactory.CustomNamespace.IsNullOrEmpty(), "DbType.Custom: InstanceFactory.CustomNamespace is not null  ");
                Check.Exception(InstanceFactory.CustomDllName.IsNullOrEmpty(), "DbType.Custom: InstanceFactory.CustomDllName is not null  ");
                break;

            default:
                throw new Exception("ConnectionConfig.DbType is null");
            }
        }