初始化提交
仓库转移到Gitea,初始化提交,可能丢失以前的git版本日志
This commit is contained in:
74
UTS_Core/UTSModule/UtsDb.vb
Normal file
74
UTS_Core/UTSModule/UtsDb.vb
Normal file
@@ -0,0 +1,74 @@
|
||||
Imports System.Data.Common
|
||||
Imports UTS_Core.Database
|
||||
|
||||
Namespace UTSModule
|
||||
''' <summary>
|
||||
''' UTS使用的数据库连接参数
|
||||
''' </summary>
|
||||
Public Class UtsDb
|
||||
Private Shared _remoteConn As New DbConnectionStringBuilder
|
||||
|
||||
Public Shared Sub InitConnectParams(license As License.License)
|
||||
RemoteDbType = DbExecutor.DbTypeEnum.Mysql
|
||||
_remoteConn.Add("Server", license.MysqlServer) '从注册表中获取
|
||||
_remoteConn.Add("Port", license.MysqlPort)
|
||||
_remoteConn.Add("User id", license.MysqlUserID)
|
||||
_remoteConn.Add("Password", license.MysqlPassword)
|
||||
_remoteConn.Add("SslMode", "none")
|
||||
RemoteConnString = _remoteConn.ToString()
|
||||
RemotePrivateDb = license.MysqlDatabase
|
||||
RemotePublicDb = license.PublicDb
|
||||
|
||||
LocalDbType = DbExecutor.DbTypeEnum.Sqlite
|
||||
Dim localConn As New DbConnectionStringBuilder
|
||||
localConn.Add("Data Source", $"{UtsRegistry.RootPath}\LocalDB\{license.SqliteName}")
|
||||
localConn.Add("Password", license.SqlitePassword)
|
||||
LocalConnString = localConn.ToString()
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' 远程数据库地址修改
|
||||
''' </summary>
|
||||
Public Shared Sub DbHostChanged(dbHost As String)
|
||||
If _remoteConn.ContainsKey("Server") Then
|
||||
_remoteConn("Server") = dbHost
|
||||
RemoteConnString = _remoteConn.ToString()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' 远程数据库类型
|
||||
''' </summary>
|
||||
Public Shared RemoteDbType As DbExecutor.DbTypeEnum
|
||||
|
||||
''' <summary>
|
||||
''' 远程数据库连接字符串
|
||||
''' </summary>
|
||||
Public Shared RemoteConnString As String
|
||||
|
||||
''' <summary>
|
||||
''' 远程私有库名
|
||||
''' </summary>
|
||||
Public Shared RemotePrivateDb As String
|
||||
|
||||
''' <summary>
|
||||
''' 远程公共库名
|
||||
''' </summary>
|
||||
Public Shared RemotePublicDb As String
|
||||
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' 本地数据库类型
|
||||
''' </summary>
|
||||
Public Shared LocalDbType As DbExecutor.DbTypeEnum
|
||||
|
||||
''' <summary>
|
||||
''' 本地数据库连接字符串
|
||||
''' </summary>
|
||||
Public Shared LocalConnString As String
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
Reference in New Issue
Block a user