問題タブ [configurationsection]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c# - c#ConfigurationSectionが重複した名前を返さない
構成ファイルから読み取る構成セクションがあります。xmlは次のようになります
この構成セクションを呼び出してカウントを行うと、最初の Product One の結果しか表示されません。製品 2 が表示されないのは、名前も「ソース」であるためです。名前が同じかどうかに関係なく、すべて表示したい。要するに、私が望んでいても、すでに出くわした同じ名前のものは返されません。誰が私が間違ったことを指摘できますか?
以下のコード
構成セクション
エレメントセクション
要素コレクション
私はそれが何かばかげていると確信しています:) よろしくお願いします!
c# - Does ConfigurationElementCollection preserve order
I need to store a list of objects to a configuration section in their prioritized order.
If I go with the standard implementation of extending ConfigurationElementCollection and ConfigurationElement (similar to what is described here). Will the order of the collection be preserved when the config file is read from and written to?
Edit: Some sample code.
Given this:
With this app.config:
When I access the list of things in code, is it guaranteed to be in the same order as specified in the config?
.net - .net 構成セクションでのリストの構成
アプリケーションの構成セクションの作成に問題があります。必要なのは、オブジェクトに変換するペアのリストを構成することだけです。ConfigurationElement および ConfigurationElementCollection クラスを使用した実装を見たことがありますが、見た目が悪く、実際にコードと構成を強制的にこのソリューションに適合させました。必要なものではないため、キーと値の属性を持つ要素を使用したくありません。構成セクションを次のようにします。
別の可能なセクション:
コードに醜いことを強制することなく、これを解析するのに役立つクラスはありますか?
ありがとうございました
c# - ConfigurationSection を Startup.cs に保存できない - Web API
起動時 ConfigurationSection
にファイルにカスタムを保存できません。web.config
一般的な実装については、このチュートリアルに従いました。単体テストに合格し、単体テストで de を保存できましたConfigurationSection
!
ClaimCollection
アプリケーションの起動時に、コントローラーのクラス名と所属するメソッド名に基づいて を構築したいと思います。
Startup.cs
BaseConfigurationSection.cs
WebApi アプリケーションを実行すると、次のエラーが発生します。
破棄されたオブジェクトにアクセスできません。オブジェクト名: 'System.Web.Http.HttpServer'。
スタックトレース:
[ObjectDisposedException: 破棄されたオブジェクトにアクセスできません。オブジェクト名: 'System.Web.Http.HttpServer'.] System.Net.Http.DelegatingHandler.CheckDisposed() +332772 System.Net.Http.DelegatingHandler.CheckDisposedOrStarted() +13 System.Net.Http.DelegatingHandler.set_InnerHandler( HttpMessageHandler 値) +23 System.Web.Http.HttpServer.Initialize() +108 System.Web.Http.HttpServer.b__b() +31 System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func` 1 valueFactory) +115 System.Threading.LazyInitializer.EnsureInitialized(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +72 System.Web.Http.HttpServer.EnsureInitialized() +119 System.Web.Http.d__0.
Configuration クラスには Dispose メソッドがありません...
この問題を解決するには?
c# - C# ConfigurationSection プロパティが空です
こんばんは、私は小さなプロジェクトに取り組んでおり、私が書いたConfigurationSectionは、web.configに入れたデータを返しません。
ここにコードを入力してください
私のコード:
ここに私のweb.configがあります
次を呼び出そうとすると
AdminSection から値を取得していません。
私が間違っているかもしれないことの単一の手がかりを持っている人はいますか?