ValidationContext Konstruktor
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Menginisialisasi instans baru dari kelas ValidationContext.
Overload
| Nama | Deskripsi |
|---|---|
| ValidationContext(Object) |
Menginisialisasi instans ValidationContext baru kelas menggunakan instans objek yang ditentukan. |
| ValidationContext(Object, IDictionary<Object,Object>) |
Menginisialisasi instans ValidationContext baru kelas menggunakan objek yang ditentukan dan tas properti opsional. |
| ValidationContext(Object, IServiceProvider, IDictionary<Object,Object>) |
Menginisialisasi instans ValidationContext baru kelas menggunakan penyedia layanan dan kamus konsumen layanan. |
| ValidationContext(Object, String, IServiceProvider, IDictionary<Object,Object>) |
Membuat untuk instans ValidationContext objek tertentu dengan |
ValidationContext(Object)
- Sumber:
- ValidationContext.cs
- Sumber:
- ValidationContext.cs
- Sumber:
- ValidationContext.cs
- Sumber:
- ValidationContext.cs
- Sumber:
- ValidationContext.cs
Menginisialisasi instans ValidationContext baru kelas menggunakan instans objek yang ditentukan.
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)
Parameter
- instance
- Object
Instans objek untuk divalidasi. Ini tidak dapat null.
- Atribut
Pengecualian
instance adalah null.
Berlaku untuk
ValidationContext(Object, IDictionary<Object,Object>)
- Sumber:
- ValidationContext.cs
- Sumber:
- ValidationContext.cs
- Sumber:
- ValidationContext.cs
- Sumber:
- ValidationContext.cs
- Sumber:
- ValidationContext.cs
Menginisialisasi instans ValidationContext baru kelas menggunakan objek yang ditentukan dan tas properti opsional.
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))
Parameter
- instance
- Object
Instans objek untuk divalidasi. Ini tidak dapat null.
- items
- IDictionary<Object,Object>
Sekumpulan pasangan kunci/nilai opsional untuk tersedia bagi konsumen.
- Atribut
Pengecualian
instance adalah null.
Keterangan
Jika items adalah null, kamus kosong dibuat. Jika items tidak null, kumpulan pasangan kunci/nilai disalin ke dalam kamus baru, mencegah konsumen memodifikasi kamus asli.
Berlaku untuk
ValidationContext(Object, IServiceProvider, IDictionary<Object,Object>)
- Sumber:
- ValidationContext.cs
- Sumber:
- ValidationContext.cs
- Sumber:
- ValidationContext.cs
- Sumber:
- ValidationContext.cs
- Sumber:
- ValidationContext.cs
Menginisialisasi instans ValidationContext baru kelas menggunakan penyedia layanan dan kamus konsumen layanan.
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))
Parameter
- instance
- Object
Objek yang akan divalidasi. Parameter ini diperlukan.
- serviceProvider
- IServiceProvider
Objek yang mengimplementasikan IServiceProvider antarmuka. Parameter ini bersifat opsional.
- items
- IDictionary<Object,Object>
Kamus pasangan kunci/nilai untuk tersedia bagi konsumen layanan. Parameter ini bersifat opsional.
- Atribut
Pengecualian
instance adalah null.
Keterangan
Parameter serviceProvider mewakili layanan yang dapat digunakan oleh GetService metode untuk melakukan validasi kustom.
items Jika parameter adalah null, kamus kosong dibuat. Jika parameter bukan null, kumpulan pasangan kunci/nilai disalin ke dalam kamus baru, yang mencegah konsumen layanan memodifikasi kamus asli.
Berlaku untuk
ValidationContext(Object, String, IServiceProvider, IDictionary<Object,Object>)
- Sumber:
- ValidationContext.cs
- Sumber:
- ValidationContext.cs
Membuat untuk instans ValidationContext objek tertentu dengan displayName, opsional serviceProvider, dan tas properti opsional dari items.
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))
Parameter
- instance
- Object
Instans objek sedang divalidasi. Ini tidak dapat null.
- displayName
- String
Nama tampilan yang terkait dengan instans objek.
- serviceProvider
- IServiceProvider
Opsional IServiceProvider untuk digunakan saat GetService(Type) dipanggil.
Jika ya null, GetService(Type) akan selalu mengembalikan null.
- items
- IDictionary<Object,Object>
Sekumpulan pasangan kunci/nilai opsional untuk tersedia bagi konsumen melalui Items.
Jika null, kamus kosong akan dibuat. Jika tidak null, kumpulan pasangan kunci/nilai akan disalin ke dalam kamus baru, mencegah konsumen memodifikasi kamus asli.
Pengecualian
Kapan instance adalah null
Keterangan
Konstruktor ini aman trim karena tidak menggunakan pantulan untuk mengatasi Jenis instance untuk mendukung pengaturan DisplayName.