ValidationContext コンストラクター
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ValidationContext クラスの新しいインスタンスを初期化します。
オーバーロード
| 名前 | 説明 |
|---|---|
| ValidationContext(Object) |
指定したオブジェクト インスタンスを使用して、 ValidationContext クラスの新しいインスタンスを初期化します。 |
| ValidationContext(Object, IDictionary<Object,Object>) |
指定したオブジェクトと省略可能なプロパティ バッグを使用して、 ValidationContext クラスの新しいインスタンスを初期化します。 |
| ValidationContext(Object, IServiceProvider, IDictionary<Object,Object>) |
サービス プロバイダーとサービス コンシューマーのディクショナリを使用して、 ValidationContext クラスの新しいインスタンスを初期化します。 |
| ValidationContext(Object, String, IServiceProvider, IDictionary<Object,Object>) |
|
ValidationContext(Object)
指定したオブジェクト インスタンスを使用して、 ValidationContext クラスの新しいインスタンスを初期化します。
public:
ValidationContext(System::Object ^ instance);
public ValidationContext(object instance);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")]
public ValidationContext(object instance);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")]
public ValidationContext(object instance);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")]
public ValidationContext(object instance);
new System.ComponentModel.DataAnnotations.ValidationContext : obj -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj -> System.ComponentModel.DataAnnotations.ValidationContext
Public Sub New (instance As Object)
パラメーター
- instance
- Object
検証するオブジェクト インスタンス。
nullすることはできません。
- 属性
例外
instance は nullです。
適用対象
ValidationContext(Object, IDictionary<Object,Object>)
指定したオブジェクトと省略可能なプロパティ バッグを使用して、 ValidationContext クラスの新しいインスタンスを初期化します。
public:
ValidationContext(System::Object ^ instance, System::Collections::Generic::IDictionary<System::Object ^, System::Object ^> ^ items);
public ValidationContext(object instance, System.Collections.Generic.IDictionary<object,object> items);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")]
public ValidationContext(object instance, System.Collections.Generic.IDictionary<object,object?>? items);
public ValidationContext(object instance, System.Collections.Generic.IDictionary<object,object?>? items);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")]
public ValidationContext(object instance, System.Collections.Generic.IDictionary<object,object?>? items);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")]
public ValidationContext(object instance, System.Collections.Generic.IDictionary<object,object?>? items);
new System.ComponentModel.DataAnnotations.ValidationContext : obj * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
Public Sub New (instance As Object, items As IDictionary(Of Object, Object))
パラメーター
- instance
- Object
検証するオブジェクト インスタンス。
nullすることはできません。
- items
- IDictionary<Object,Object>
コンシューマーが使用できるようにするキーと値のペアのオプション セット。
- 属性
例外
instance は nullです。
注釈
itemsがnullされている場合は、空のディクショナリが作成されます。
itemsが null でない場合、キーと値のペアのセットが新しいディクショナリにコピーされ、コンシューマーが元のディクショナリを変更できなくなります。
適用対象
ValidationContext(Object, IServiceProvider, IDictionary<Object,Object>)
サービス プロバイダーとサービス コンシューマーのディクショナリを使用して、 ValidationContext クラスの新しいインスタンスを初期化します。
public:
ValidationContext(System::Object ^ instance, IServiceProvider ^ serviceProvider, System::Collections::Generic::IDictionary<System::Object ^, System::Object ^> ^ items);
public ValidationContext(object instance, IServiceProvider serviceProvider, System.Collections.Generic.IDictionary<object,object> items);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")]
public ValidationContext(object instance, IServiceProvider? serviceProvider, System.Collections.Generic.IDictionary<object,object?>? items);
public ValidationContext(object instance, IServiceProvider? serviceProvider, System.Collections.Generic.IDictionary<object,object?>? items);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")]
public ValidationContext(object instance, IServiceProvider? serviceProvider, System.Collections.Generic.IDictionary<object,object?>? items);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")]
public ValidationContext(object instance, IServiceProvider? serviceProvider, System.Collections.Generic.IDictionary<object,object?>? items);
new System.ComponentModel.DataAnnotations.ValidationContext : obj * IServiceProvider * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj * IServiceProvider * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj * IServiceProvider * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj * IServiceProvider * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
Public Sub New (instance As Object, serviceProvider As IServiceProvider, items As IDictionary(Of Object, Object))
パラメーター
- instance
- Object
検証するオブジェクト。 このパラメーターは必須です。
- serviceProvider
- IServiceProvider
IServiceProvider インターフェイスを実装するオブジェクト。 このパラメーターは省略可能です。
- items
- IDictionary<Object,Object>
サービス コンシューマーが使用できるようにするキーと値のペアのディクショナリ。 このパラメーターは省略可能です。
- 属性
例外
instance は nullです。
注釈
serviceProvider パラメーターは、カスタム検証を実行するために GetService メソッドで使用できるサービスを表します。
items パラメーターがnull場合は、空のディクショナリが作成されます。 パラメーターが nullされていない場合、キーと値のペアのセットが新しいディクショナリにコピーされるため、サービス コンシューマーは元のディクショナリを変更できなくなります。
適用対象
ValidationContext(Object, String, IServiceProvider, IDictionary<Object,Object>)
displayName、省略可能なserviceProvider、およびitemsの省略可能なプロパティ バッグを使用して、特定のオブジェクト インスタンスのValidationContextを構築します。
public:
ValidationContext(System::Object ^ instance, System::String ^ displayName, IServiceProvider ^ serviceProvider, System::Collections::Generic::IDictionary<System::Object ^, System::Object ^> ^ items);
public ValidationContext(object instance, string displayName, IServiceProvider? serviceProvider, System.Collections.Generic.IDictionary<object,object?>? items);
new System.ComponentModel.DataAnnotations.ValidationContext : obj * string * IServiceProvider * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
Public Sub New (instance As Object, displayName As String, serviceProvider As IServiceProvider, items As IDictionary(Of Object, Object))
パラメーター
- instance
- Object
検証対象のオブジェクト インスタンス。
nullすることはできません。
- displayName
- String
オブジェクト インスタンスに関連付けられている表示名。
- serviceProvider
- IServiceProvider
GetService(Type)が呼び出されたときに使用する省略可能なIServiceProvider。
nullの場合、GetService(Type)は常にnullを返します。
- items
- IDictionary<Object,Object>
Itemsを介してコンシューマーが使用できるようにするキーと値のペアのオプション セット。
null場合は、空のディクショナリが作成されます。
nullしない場合、キーと値のペアのセットが新しいディクショナリにコピーされ、コンシューマーが元のディクショナリを変更できなくなります。
例外
instanceがnull
注釈
このコンストラクターは、リフレクションを使用して DisplayName の設定をサポートする instance の型を解決しないため、トリミング セーフです。