ValidationAttribute Sınıf

Tanım

Tüm doğrulama öznitelikleri için temel sınıf olarak işlev görür.Serves as the base class for all validation attributes.

public ref class ValidationAttribute abstract : Attribute
public abstract class ValidationAttribute : Attribute
type ValidationAttribute = class
    inherit Attribute
Public MustInherit Class ValidationAttribute
Inherits Attribute
Devralma
ValidationAttribute
Türetilmiş

Açıklamalar

Bu sınıf, veri tablosuyla ilişkili meta verilere göre doğrulamayı zorlar.This class enforces validation, based on the metadata that is associated with the data table. Özel doğrulama öznitelikleri oluşturmak için bu sınıfı geçersiz kılabilirsiniz.You can override this class to create custom validation attributes.

Oluşturucular

ValidationAttribute()

ValidationAttribute sınıfının yeni bir örneğini başlatır.Initializes a new instance of the ValidationAttribute class.

ValidationAttribute(Func<String>)

ValidationAttributeDoğrulama kaynaklarına erişim sağlayan işlevini kullanarak sınıfının yeni bir örneğini başlatır.Initializes a new instance of the ValidationAttribute class by using the function that enables access to validation resources.

ValidationAttribute(String)

ValidationAttributeBir doğrulama denetimiyle ilişkilendirmek üzere hata iletisini kullanarak sınıfının yeni bir örneğini başlatır.Initializes a new instance of the ValidationAttribute class by using the error message to associate with a validation control.

Özellikler

ErrorMessage

Doğrulama başarısız olursa doğrulama denetimiyle ilişkilendirilecek bir hata iletisi alır veya ayarlar.Gets or sets an error message to associate with a validation control if validation fails.

ErrorMessageResourceName

Doğrulama başarısız olursa özellik değerini aramak için kullanılacak hata iletisi kaynak adını alır veya ayarlar ErrorMessageResourceType .Gets or sets the error message resource name to use in order to look up the ErrorMessageResourceType property value if validation fails.

ErrorMessageResourceType

Doğrulama başarısız olursa hata iletisi arama için kullanılacak kaynak türünü alır veya ayarlar.Gets or sets the resource type to use for error-message lookup if validation fails.

ErrorMessageString

Yerelleştirilmiş doğrulama hata iletisini alır.Gets the localized validation error message.

RequiresValidationContext

Özniteliğin doğrulama bağlamı gerektirip gerektirmediğini gösteren bir değer alır.Gets a value that indicates whether the attribute requires validation context.

TypeId

Türetilmiş bir sınıfta uygulandığında, bunun için benzersiz bir tanımlayıcı alır Attribute .When implemented in a derived class, gets a unique identifier for this Attribute.

(Devralındığı yer: Attribute)

Yöntemler

Equals(Object)

Bu örneğin belirtilen bir nesneye eşit olup olmadığını gösteren bir değeri döndürür.Returns a value that indicates whether this instance is equal to a specified object.

(Devralındığı yer: Attribute)
FormatErrorMessage(String)

Hatanın gerçekleştiği veri alanına göre bir hata iletisine biçimlendirme uygular.Applies formatting to an error message, based on the data field where the error occurred.

GetHashCode()

Bu örneğe ilişkin karma kodu döndürür.Returns the hash code for this instance.

(Devralındığı yer: Attribute)
GetType()

TypeGeçerli örneği alır.Gets the Type of the current instance.

(Devralındığı yer: Object)
GetValidationResult(Object, ValidationContext)

Geçerli doğrulama özniteliğine göre belirtilen değerin geçerli olup olmadığını denetler.Checks whether the specified value is valid with respect to the current validation attribute.

IsDefaultAttribute()

Türetilmiş bir sınıfta geçersiz kılınırsa, bu örneğin değerinin türetilmiş sınıf için varsayılan değer olup olmadığını gösterir.When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Devralındığı yer: Attribute)
IsValid(Object)

Nesnenin belirtilen değerinin geçerli olup olmadığını belirler.Determines whether the specified value of the object is valid.

IsValid(Object, ValidationContext)

Geçerli doğrulama özniteliğine göre belirtilen değeri doğrular.Validates the specified value with respect to the current validation attribute.

Match(Object)

Türetilmiş bir sınıfta geçersiz kılınırsa, bu örneğin belirtilen bir nesneye eşit olup olmadığını gösteren bir değer döndürür.When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Devralındığı yer: Attribute)
MemberwiseClone()

Geçerli bir basit kopyasını oluşturur Object .Creates a shallow copy of the current Object.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden dizeyi döndürür.Returns a string that represents the current object.

(Devralındığı yer: Object)
Validate(Object, String)

Belirtilen nesneyi doğrular.Validates the specified object.

Validate(Object, ValidationContext)

Belirtilen nesneyi doğrular.Validates the specified object.

Belirtik Arabirim Kullanımları

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Bir ad kümesini karşılık gelen bir dağıtma tanımlayıcısı kümesine eşler.Maps a set of names to a corresponding set of dispatch identifiers.

(Devralındığı yer: Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Bir arabirimin tür bilgilerini almak için kullanılabilen bir nesnenin tür bilgilerini alır.Retrieves the type information for an object, which can be used to get the type information for an interface.

(Devralındığı yer: Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Bir nesnenin sağladığı tür bilgisi arabirimlerinin sayısını alır (0 ya da 1).Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Devralındığı yer: Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Bir nesne tarafından sunulan özelliklere ve yöntemlere erişim sağlar.Provides access to properties and methods exposed by an object.

(Devralındığı yer: Attribute)

Şunlara uygulanır