如何使用 C# 将 AppSettings.json 转换为高级 Azure 设置? [英] How to convert AppSettings.json to Advance Azure Settings with C#?
问题描述
您是否注意到 Azure 升级了 AppSettings Management?现在可以使用高级编辑选项一次性更新多个 AppSettings,但格式与 AppSettings.json 不同.
我正在寻找一种快速解决方案,将我的 AppSettings 部分转换为 Azure 高级编辑选项格式.你知道怎么做吗?
所以:
模拟":{"ApiUrl": "YourApiUrl","ApiKey": "YouApiKey",组":[{"Name": "你的组",纬度":45.50884,经度":-73.58781,半径":500}],计划":[{"GroupName": "你的组","在": "07:00",状态":10}]}
将被格式化为:
<预><代码>[{"Name": "Simulation:ApiUrl","Value": "YourApiUrl",SlotSetting":false},{"Name": "Simulation:ApiKey","Value": "YourApiKey",SlotSetting":false},{"Name": "Simulation:Groups:0:Name","值": "你的组",SlotSetting":false},{"Name": "Simulation:Groups:0:Latitude","值": "45.50884",SlotSetting":false},{"Name": "Simulation:Groups:0:Longitude",值":-73.58781",SlotSetting":false},{"Name": "Simulation:Groups:0:Radius",价值":500",SlotSetting":false},{"Name": "Simulation:Planifications:0:GroupName","值": "你的组",SlotSetting":false},{"Name": "Simulation:Planifications:0:At","值": "07:00:00",SlotSetting":false},{"Name": "Simulation:Planifications:0:Status","值": "10",SlotSetting":false}]Nuget 上有一个 dotnet 工具可以进行转换 dotnet-appsettings.需要.NET 3.1 SDK.
dotnet 工具安装 --global dotnet-appsettingsdotnet 工具列表 --global用法:appsettings [appsettings.json]
Did you notice that Azure upgraded the AppSettings Management? Now it s possible to update multiple AppSettings in one shot using the Advanced Edit Options, but the formating is not the same as AppSettings.json.
I m looking for a quick solution to convert my AppSettings section to Azure Advance Edit options format. Do you know how to do that?
So this:
"Simulation": {
"ApiUrl": "YourApiUrl",
"ApiKey": "YouApiKey",
"Groups": [
{
"Name": "YourGroup",
"Latitude": 45.50884,
"Longitude": -73.58781,
"Radius": 500
}
],
"Planifications": [
{
"GroupName": "YourGroup",
"At": "07:00",
"Status": 10
}
]
}
will be formatted like:
[
{
"Name": "Simulation:ApiUrl",
"Value": "YourApiUrl",
"SlotSetting": false
},
{
"Name": "Simulation:ApiKey",
"Value": "YourApiKey",
"SlotSetting": false
},
{
"Name": "Simulation:Groups:0:Name",
"Value": "YourGroup",
"SlotSetting": false
},
{
"Name": "Simulation:Groups:0:Latitude",
"Value": "45.50884",
"SlotSetting": false
},
{
"Name": "Simulation:Groups:0:Longitude",
"Value": "-73.58781",
"SlotSetting": false
},
{
"Name": "Simulation:Groups:0:Radius",
"Value": "500",
"SlotSetting": false
},
{
"Name": "Simulation:Planifications:0:GroupName",
"Value": "YourGroup",
"SlotSetting": false
},
{
"Name": "Simulation:Planifications:0:At",
"Value": "07:00:00",
"SlotSetting": false
},
{
"Name": "Simulation:Planifications:0:Status",
"Value": "10",
"SlotSetting": false
}
]
There is a dotnet tool can do the conversion on Nuget dotnet-appsettings. It is required .NET 3.1 SDK.
dotnet tool install --global dotnet-appsettings
dotnet tool list --global
Usage: appsettings [appsettings.json]
这篇关于如何使用 C# 将 AppSettings.json 转换为高级 Azure 设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!