增加老版本 KJDWebService
This commit is contained in:
1 parent
58abbb5b4f
commit
f84c4c1949
115 files changed
+36598
-18
No files matched your search
@@ -0,0 +1,40 @@
|
||||
using FreeSql;
|
||||
using MAX.Core.DependencyInjection;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StoreHub.Framework.Repositorys;
|
||||
using StoreHub.KJDWebService.Commons;
|
||||
|
||||
namespace StoreHub.KJDWebService.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 迁移服务基类:注入 SqlRepository(提供 KJDDB IAdo)与 IConfiguration。
|
||||
/// 提供 MySql(connKey[, isUseTrans]) 创建与旧 MysqlUtils 兼容的执行器(内部参数化执行)。
|
||||
/// </summary>
|
||||
public abstract class ServiceBase : ITransientDependency
|
||||
{
|
||||
protected readonly SqlRepository _sqlRepository;
|
||||
protected readonly IConfiguration _configuration;
|
||||
|
||||
protected ServiceBase(SqlRepository sqlRepository, IConfiguration configuration)
|
||||
{
|
||||
_sqlRepository = sqlRepository;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>KJDDB 的 IAdo(等效旧 ConnKJD)</summary>
|
||||
protected IAdo Ado => _sqlRepository.Ado;
|
||||
|
||||
/// <summary>创建 MysqlUtils(等效旧 new MysqlUtils(conn[, isUseTrans]))</summary>
|
||||
protected MysqlUtils MySql(string connKey, bool isUseTrans = false)
|
||||
{
|
||||
return new MysqlUtils(AdoProvider.Get(connKey), isUseTrans);
|
||||
}
|
||||
|
||||
/// <summary>读取配置(旧 ConfigurationManager.ConnectionStrings["key"].ConnectionString)</summary>
|
||||
protected string Config(string key)
|
||||
{
|
||||
return KJDConfig.Get(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user