37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
|
using SqlSugar;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data.Common;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace Sinvo.EplanHpD.Plugin.Service
|
|||
|
{
|
|||
|
public class DBHelper
|
|||
|
{
|
|||
|
private static string _dbUser = "sa";
|
|||
|
private static string _dbPassword = "Sa1234";
|
|||
|
private static string _dbServer = ".";
|
|||
|
private static string _dbName = "MotorData";
|
|||
|
|
|||
|
private static string _connectionString => $"Server={_dbServer};Database={_dbName};User Id={_dbUser};Password={_dbPassword};";
|
|||
|
|
|||
|
private static SqlSugarClient _db;
|
|||
|
public static SqlSugarClient DB
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
_db = new SqlSugarClient(new ConnectionConfig()
|
|||
|
{
|
|||
|
ConnectionString = _connectionString,
|
|||
|
DbType = DbType.SqlServer,
|
|||
|
IsAutoCloseConnection = true,
|
|||
|
InitKeyType = InitKeyType.Attribute
|
|||
|
});
|
|||
|
return _db;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|