如何在 AppService 中获取连接字符串?

How to get connection string in AppService?

是否可以从应用服务获取连接字符串?我想直接使用Dapper如下:

using (IDbConnection db = new SqlConnection(_connString))
{
   //My code here
}

我可以从 App Service 获取 _connString 吗?

有一个 Dapper 集成的 ABP。

从 Nuget 安装 Dapper https://www.nuget.org/packages/Abp.Dapper

并阅读文档 https://aspnetboilerplate.com/Pages/Documents/Dapper-Integration

如果您仍想获取连接字符串,您可以从配置中获取

ConfigurationManager.ConnectionStrings["Default"];

或者您可以创建自定义存储库并从 DbContext 获取它