30 lines
953 B
C#
30 lines
953 B
C#
using Newtonsoft.Json;
|
|
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace 智能仓储WCS管理系统
|
|
{
|
|
/// <summary>
|
|
/// 默认数据库
|
|
/// </summary>
|
|
public static class DataDb
|
|
{
|
|
public static SqlSugarScope db = new SqlSugarScope(new ConnectionConfig()
|
|
{
|
|
ConnectionString = LocalFile.Config.MySql,
|
|
DbType = DbType.MySqlConnector,
|
|
IsAutoCloseConnection = true
|
|
}, db =>
|
|
{
|
|
db.Aop.OnError = ex =>
|
|
{
|
|
Logs.Write($@"{nameof(DataDb)}{Environment.NewLine}SQL:{ex?.Sql}{Environment.NewLine}Parametres:{JsonConvert.SerializeObject(ex?.Parametres)}{Environment.NewLine}InnerException:{ex?.InnerException?.ToString()}{Environment.NewLine}Exception:{ex?.ToString()}{Environment.NewLine}", LogsType.DbErr);
|
|
};
|
|
});
|
|
}
|
|
}
|