SmartSQL/SmartSQL.Framework/SQLiteHelper.cs

(开头部分) 6KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Linq.Expressions;
using System.Runtime.Serialization.Json;
using SmartSQL.Framework.Const;
using SmartSQL.Framework.SqliteModel;
using SQLite;

namespace SmartSQL.Framework
{
    public class SQLiteHelper
    {
        public static string BasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.Create),
            "SmartSQL");
        public string connstr = Path.Combine(BasePath, "SmartSQL.db");//没有数据库会创建数据库
        public SQLiteConnection db;

        private static SQLiteHelper _instance;

        private static readonly object obj = new object();
        public static SQLiteHelper GetInstance()
        {
            if (_instance == null)
            {
                lock (obj)  //加锁防止多线程
                {
                    if (_instance == null)
                    {
                        _instance = new SQLiteHelper();
                    }
                }
            }
            return _instance;
        }

        public SQLiteHelper()
        {
            if (!Directory.Exists(BasePath))
            {
                Directory.CreateDirectory(BasePath);
            }
            db = new SQLiteConnection(connstr);
            //表已存在不会重复创建
            db.CreateTable<ConnectConfigs>();
            db.CreateTable<GroupInfo>();
            db.CreateTable<TagInfo>();
            db.CreateTable<GroupObjects>();
            db.CreateTable<TagObjects>();
            db.CreateTable<SystemSet>();
            Init();
        }

        public List<SystemSet> InitValue = new List<SystemSet>
        {
            new SystemSet{Name = SysConst.Sys_IsGroup,Type = 1,Value = "false"},
            new SystemSet{Name = SysConst.Sys_IsMultipleTab,Type = 1,Value = "false"},
后面还有 139 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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