public Form4(string tablename, string space, string dbconn, Facade.Enums.DbTypes type, string template, string savepath, string myfilename)
        {
            InitializeComponent();
            TableName = tablename;

            List <string> list = new List <string>();

            list.Add(tablename);


            Facade.CodeBuilder builder = new CodeBuilder(list, space, dbconn, type, template, savepath, myfilename);
            richTextBox1.SelectionFont = new Font("楷体", 18, FontStyle.Bold);
            this.richTextBox1.Text     = builder.PerView();
        }
        public static SqlSugarClient Db(string conn, Facade.Enums.DbTypes _dbType)
        {
            var dbType = ConvertDbType(_dbType);

            SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
            {
                ConnectionString = conn,
                DbType           = dbType,

                InitKeyType           = InitKeyType.Attribute, //从特性读取主键和自增列信息
                IsAutoCloseConnection = true,                  //开启自动释放模式和EF原理一样我就不多解释了
            });

            return(db);
        }
Exemple #3
0
        public static string ConnString(Facade.Enums.DbTypes dbTypes, OperationModel model)
        {
            switch (dbTypes)
            {
            case Enums.DbTypes.Oracle:
                return(OracleConnString(model));

            case Enums.DbTypes.SqlServer:
                return(SqlServerConnString(model));

            case Enums.DbTypes.MySQL:
                return(MySQLConnString(model));

            case Enums.DbTypes.SQLite:
                return(SqliteString(model));

            default:
                return(OracleConnString(model));
            }
        }
        public static SqlSugar.DbType ConvertDbType(Facade.Enums.DbTypes _dbType)
        {
            switch (_dbType)
            {
            case Enums.DbTypes.Oracle:
                return(SqlSugar.DbType.Oracle);

            case Enums.DbTypes.SqlServer:
                return(SqlSugar.DbType.SqlServer);

            case Enums.DbTypes.MySQL:
                return(SqlSugar.DbType.MySql);

            case Enums.DbTypes.SQLite:
                return(SqlSugar.DbType.Sqlite);

            default:
                return(SqlSugar.DbType.Oracle);
            }
        }
Exemple #5
0
        public static IDbOperation DbOperation(Facade.Enums.DbTypes type, string conn)
        {
            var db = DbHelper.Db(conn, type);

            switch (type)
            {
            case Enums.DbTypes.Oracle:
                return(new  OracleDbOperation(db));

            case Enums.DbTypes.SqlServer:
                return(new SqlServerDbOperation(db));

            case Enums.DbTypes.MySQL:
                return(new MySQLDbOperation(db));

            case Enums.DbTypes.SQLite:
                return(new SQLiteDbOperation(db));

            default:
                return(new  OracleDbOperation(db));
            }
        }