Entity.ValidateProperty Method (String, Object)

[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]

Indicates whether the specified value is valid for the specified property of the current entity.

Namespace:  System.ServiceModel.DomainServices.Client
Assembly:  System.ServiceModel.DomainServices.Client (in System.ServiceModel.DomainServices.Client.dll)

Syntax

'Declaration
Protected Sub ValidateProperty ( _
    propertyName As String, _
    value As Object _
)
'Usage
Dim propertyName As String
Dim value As Object

Me.ValidateProperty(propertyName, _
    value)
protected void ValidateProperty(
    string propertyName,
    Object value
)
protected:
void ValidateProperty(
    String^ propertyName, 
    Object^ value
)
member ValidateProperty : 
        propertyName:string * 
        value:Object -> unit 
protected function ValidateProperty(
    propertyName : String, 
    value : Object
)

Parameters

  • propertyName
    Type: System.String
    The name of the property on this entity to set. This name cannot be nulla null reference (Nothing in Visual Basic) or empty.
  • value
    Type: System.Object
    The value to test. It may be nulla null reference (Nothing in Visual Basic) if nulla null reference (Nothing in Visual Basic) is valid for the given property.

Exceptions

Exception Condition
[InvalidOperationException]

if this property is marked with [EditableAttribute] configured to prevent editing.

[ValidationException]

if this value is not valid for the specified property.

Remarks

This method evaluates all the [ValidationAttribute] attributes associated with the specified property and throws a [ValidationException] for the first one that signals a validation error. It also verifies the property is not read-only.

All validation logic is bypassed if this entity is currently being deserialized.

See Also

Reference

Entity Class

ValidateProperty Overload

System.ServiceModel.DomainServices.Client Namespace