using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using XuguClient;
namespace SqlSugar.Xugu
{
///
/// 虚谷 ADO 提供器
///
public class XuguProvider : AdoProvider
{
///
/// 构造函数
///
public XuguProvider() { }
///
/// 数据库连接对象
///
public override IDbConnection Connection
{
get
{
if (base._DbConnection == null)
{
try
{
base._DbConnection = new XGConnection(base.Context.CurrentConnectionConfig.ConnectionString);
}
catch (Exception ex)
{
throw ex;
}
}
return base._DbConnection;
}
set
{
base._DbConnection = value;
}
}
public override string SqlParameterKeyWord => ":";
public string SplitCommandTag => UtilConstants.ReplaceCommaKey.Replace("{", "").Replace("}", "");
public override object GetScalar(string sql, params SugarParameter[] parameters)
{
if (this.Context.Ado.Transaction != null) return _GetScalar(sql, parameters);
try
{
this.Context.Ado.BeginTran();
var result = _GetScalar(sql, parameters);
this.Context.Ado.CommitTran();
return result;
}
catch (Exception ex)
{
this.Context.Ado.RollbackTran();
throw ex;
}
}
public override async Task