|
@@ -4,7 +4,7 @@ using System.Linq.Expressions;
|
|
|
using Universal;
|
|
|
|
|
|
namespace SqlSugarORM;
|
|
|
-public class SqlSugarCustom : IORM
|
|
|
+public class SqlSugarCustom
|
|
|
{
|
|
|
public SqlSugarCustom()
|
|
|
{
|
|
@@ -13,7 +13,7 @@ public class SqlSugarCustom : IORM
|
|
|
|
|
|
#region Internal
|
|
|
private IOrmProvider? _provider;
|
|
|
- private SqlSugarClient? _Client;
|
|
|
+ public SqlSugarClient? _Client;
|
|
|
private bool disposedValue;
|
|
|
private readonly EventQueue<(string, DateTime, LogLevel)> _logQueue;
|
|
|
private void LogQueueHandler((string log, DateTime time, LogLevel level) logItem)
|
|
@@ -31,7 +31,7 @@ public class SqlSugarCustom : IORM
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
- bool IORM.Initialize(IOrmProvider? notify)
|
|
|
+ public bool Initialize(IOrmProvider? notify)
|
|
|
{
|
|
|
if (_provider is not null)
|
|
|
return false;
|
|
@@ -41,7 +41,7 @@ public class SqlSugarCustom : IORM
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- bool IORM.Open(string connectionString, ORM.DbType dbType, bool isAutoConnection)
|
|
|
+ public bool Open(string connectionString, SqlSugar.DbType dbType, bool isAutoConnection)
|
|
|
{
|
|
|
if (this._Client is not null)
|
|
|
return false;
|
|
@@ -49,7 +49,7 @@ public class SqlSugarCustom : IORM
|
|
|
ConnectionConfig config = new()
|
|
|
{
|
|
|
ConnectionString = connectionString,
|
|
|
- DbType = (SqlSugar.DbType)dbType,
|
|
|
+ DbType = dbType,
|
|
|
IsAutoCloseConnection = isAutoConnection
|
|
|
};
|
|
|
try
|
|
@@ -65,7 +65,7 @@ public class SqlSugarCustom : IORM
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- bool IORM.CreateDataBase(string dbName)
|
|
|
+ public bool CreateDataBase(string dbName)
|
|
|
{
|
|
|
if (this._Client is null)
|
|
|
return false;
|
|
@@ -86,7 +86,7 @@ public class SqlSugarCustom : IORM
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- bool IORM.CreateTable<T>(string? tableName)
|
|
|
+ public bool CreateTable<T>(string? tableName)
|
|
|
{
|
|
|
if (this._Client is null)
|
|
|
return false;
|
|
@@ -108,7 +108,7 @@ public class SqlSugarCustom : IORM
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- bool IORM.Insert<T>(T data)
|
|
|
+ public bool Insert<T>(T data) where T : class, new()
|
|
|
{
|
|
|
if (this._Client is null)
|
|
|
return false;
|
|
@@ -126,7 +126,7 @@ public class SqlSugarCustom : IORM
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- bool IORM.Insert<T>(string tablename, T data)
|
|
|
+ public bool Insert<T>(string tablename, T data) where T : class, new()
|
|
|
{
|
|
|
if (this._Client is null)
|
|
|
return false;
|
|
@@ -150,7 +150,7 @@ public class SqlSugarCustom : IORM
|
|
|
}
|
|
|
|
|
|
|
|
|
- async Task<bool> IORM.Query<T>(Action<List<T>> results)
|
|
|
+ public async Task<bool> Query<T>(Action<List<T>> results)
|
|
|
{
|
|
|
if (this._Client is null)
|
|
|
return false;
|
|
@@ -170,7 +170,7 @@ public class SqlSugarCustom : IORM
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- async Task<bool> IORM.Query<T>(string tableName, Action<List<T>> results)
|
|
|
+ public async Task<bool> Query<T>(string tableName, Action<List<T>> results)
|
|
|
{
|
|
|
if (this._Client is null)
|
|
|
return false;
|
|
@@ -193,7 +193,7 @@ public class SqlSugarCustom : IORM
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- async Task<bool> IORM.Query<T>(Expression<Func<T, bool>> expression, Action<List<T>> results)
|
|
|
+ public async Task<bool> Query<T>(Expression<Func<T, bool>> expression, Action<List<T>> results)
|
|
|
{
|
|
|
if (this._Client is null)
|
|
|
return false;
|
|
@@ -213,7 +213,7 @@ public class SqlSugarCustom : IORM
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- async Task<bool> IORM.Query<T>(string tableName, Expression<Func<T, bool>> expression, Action<List<T>> results)
|
|
|
+ public async Task<bool> Query<T>(string tableName, Expression<Func<T, bool>> expression, Action<List<T>> results)
|
|
|
{
|
|
|
if (this._Client is null)
|
|
|
return false;
|
|
@@ -240,7 +240,7 @@ public class SqlSugarCustom : IORM
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- bool IORM.Delete<T>(string tableName, Expression<Func<T, bool>> expression)
|
|
|
+ public bool Delete<T>(string tableName, Expression<Func<T, bool>> expression) where T : class, new()
|
|
|
{
|
|
|
if (this._Client is null)
|
|
|
return false;
|