Elight.Logic/BaseLogic.cs

(开头部分) 16KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Elight.Utility.Extension.DataCache;
using Elight.Utility.Extension.SqlSugar;
using System.Data;
using JinianNet.JNTemplate;
using Elight.Utility.Extension;
using Elight.Entity.Base;
using Elight.Utility.Core;

namespace Elight.Logic.Base
{
    public class BaseLogic
    {
        private static string ConnectionString;
        private static SqlSugar.DbType DbType;
        private static string DbName;
        private static bool DebugMode;

        public static bool InitDB(string dbType, string host, string dbName, string userName, string pasword, ref string message, bool debug = false)
        {
            DebugMode = debug;
            DbName = dbName;
            if (dbType.ToLower() == "SqlServer".ToLower())
            {
                DbType = SqlSugar.DbType.SqlServer;
                ConnectionString = $"Data Source={host};Initial Catalog={dbName};User ID={userName};Password={pasword};";
                return true;
            }
            else if (dbType.ToLower() == "MySql".ToLower())
            {
                DbType = SqlSugar.DbType.MySql;
                ConnectionString = $"server={host};Database={dbName};Uid={userName};Pwd={pasword};";
                return true;
            }
            else if (dbType.ToLower() == "Oracle".ToLower())
            {
                DbType = SqlSugar.DbType.Oracle;
                ConnectionString = $"Data Source={host}/{dbName};User ID={userName};Password={pasword};";
                return true;
            }
            else if (dbType.ToLower() == "PostgreSql".ToLower())
            {
                DbType = SqlSugar.DbType.PostgreSQL;
                ConnectionString = $"Server={host};Port=5432;Database={dbName};User Id={userName};Password={pasword};";
                return true;
            }
            else if (dbType.ToLower() == "Sqlite".ToLower())
            {
                DbType = SqlSugar.DbType.Sqlite;

                var template = Engine.CreateTemplate(dbName);
                template.Set("BaseDirectory", MyEnvironment.RootPath(""));
                var result = template.Render();

                ConnectionString = $"DataSource={result};";
                return true;
后面还有 235 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。