Azure 函数 - 如何在 app.config 中添加我的数据库连接字符串

Azure functions - How to add my database connection string in app.config

在 Azure 函数中使用 C# 从 app.config 获取数据库字符串。

我通过以下方式访问字符串:

var Conn = ConfigurationManager
                   .ConnectionStrings["ConnString"].ConnectionString

正在寻找使用连接字符串控制数据库的好方法。

在 azure 函数中使用 Asp.Net 核心配置系统时,建议使用配置管理器。

您可以通过 GetConnectionStringConfigurationBuilder

访问它

var connectionString = config.GetConnectionString("SqlConnectionString");

按照此 link 在您的项目中添加配置 - https://blog.jongallant.com/2018/01/azure-function-config/