ServiceScopeExtension クラス
BuildContextから祖先の依存性注入コンテナーを使用してサービスを解決する拡張メソッドを提供します。
名前空間: FloatSoda.Widgets
アセンブリ: FloatSoda.dll
public static class ServiceScopeExtensionobject ← ServiceScopeExtension
継承したメンバー
Section titled “継承したメンバー”object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
GetRequiredService<T>(IBuildContext)
Section titled “GetRequiredService<T>(IBuildContext)”最も近い祖先の依存性注入コンテナーから、登録必須のサービスを取得します。
public static T GetRequiredService<T>(this IBuildContext context) where T : notnullパラメーター
Section titled “パラメーター”context IBuildContext
サービスを要求するウィジェットのBuildContext。
T
依存性注入コンテナーに登録されているサービス。
型パラメーター
Section titled “型パラメーター”T
取得するサービスの型。
祖先にServiceProviderが存在しない場合、または要求したサービスが登録されていない場合に スローされます。
GetService<T>(IBuildContext)
Section titled “GetService<T>(IBuildContext)”最も近い祖先の依存性注入コンテナーから、登録されている場合にサービスを取得します。
public static T? GetService<T>(this IBuildContext context)パラメーター
Section titled “パラメーター”context IBuildContext
サービスを要求するウィジェットのBuildContext。
T?
登録されているサービス。登録されていない場合はnull。
型パラメーター
Section titled “型パラメーター”T
取得するサービスの型。
祖先にServiceProviderが存在しない場合にスローされます。