using Monitor.FrameWork;
|
|
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Aborlen.Model
|
|
{
|
|
public partial class SqlSugarAdo
|
|
{
|
|
public static DataTable GetDataTable(string sql,object parameter)
|
|
{
|
|
|
|
|
|
|
|
using (SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = UserConfiguration.ConnectionString, DbType = SqlSugar.DbType.SqlServer, IsAutoCloseConnection = true }))
|
|
{
|
|
|
|
return db.Ado.GetDataTable(sql, parameter);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public static List<T> SqlQuery<T>(string sql, params SugarParameter[] parameters)
|
|
{
|
|
using (SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = UserConfiguration.ConnectionString, DbType = SqlSugar.DbType.SqlServer, IsAutoCloseConnection = true }))
|
|
{
|
|
|
|
return db.Ado.SqlQuery<T>(sql, parameters);//比db.SqlQueryable兼容性更强,支持复杂SQL存储过程,缺点没有自带的分页操作
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public static int ExecuteCommand(string sql, params SugarParameter[] parameter)
|
|
{
|
|
|
|
|
|
|
|
using (SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = UserConfiguration.ConnectionString, DbType = SqlSugar.DbType.SqlServer, IsAutoCloseConnection = true }))
|
|
{
|
|
|
|
return db.Ado.ExecuteCommand(sql, parameter);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|