AssetManager.UniApp/AssetManager/AssetManager.API/AssetManager.Data/SqlSugarConfig.cs

28 lines
838 B
C#

using SqlSugar;
namespace AssetManager.Data;
public class SqlSugarConfig
{
public static ISqlSugarClient GetSqlSugarClient()
{
return new SqlSugarScope(new ConnectionConfig()
{
ConnectionString = "server=43.167.226.216;Database=assetmanager;Uid=AssetManager;Pwd=2XpcnYGTpB5BhJyG;CharSet=utf8mb4;",
DbType = DbType.MySql,
IsAutoCloseConnection = true,
InitKeyType = InitKeyType.Attribute,
ConfigureExternalServices = new ConfigureExternalServices
{
EntityService = (property, column) =>
{
if (property.PropertyType == typeof(DateTime))
{
column.DataType = "datetime(3)";
}
}
}
});
}
}