因此,在 Blazor 中,您將獲得一個將 IConfiguration 實作為默認服務的實體。無需自己注冊。我的問題是:我可以將其他 .json 檔案加載到默認的 IConfiguration 實體中嗎?如果沒有,是否可以注冊我自己的 IConfiguration 并將不同的 .json 檔案加載到其中?如果是這樣,怎么辦?
uj5u.com熱心網友回復:
這里有一些有用的檔案:
是的,您可以像這樣加載其他檔案:
(假設 var 流是來自 Json 組態檔的流)。
builder.Configuration.AddJsonStream(stream);
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/431754.html
上一篇:asp.netxhr.send中的錯誤Ajxa呼叫(options.hasContent&&options.data||null)
