UpdateAttribute Class
[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.]
Specifies that a DomainService method is an update method.
Inheritance Hierarchy
System.Object
System.Attribute
System.ServiceModel.DomainServices.Server.UpdateAttribute
Namespace: System.ServiceModel.DomainServices.Server
Assembly: System.ServiceModel.DomainServices.Server (in System.ServiceModel.DomainServices.Server.dll)
Syntax
'Declaration
<AttributeUsageAttribute(AttributeTargets.Method Or AttributeTargets.Property Or AttributeTargets.Field, AllowMultiple := False, _
Inherited := True)> _
Public NotInheritable Class UpdateAttribute _
Inherits Attribute
'Usage
Dim instance As UpdateAttribute
[AttributeUsageAttribute(AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false,
Inherited = true)]
public sealed class UpdateAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Method|AttributeTargets::Property|AttributeTargets::Field, AllowMultiple = false,
Inherited = true)]
public ref class UpdateAttribute sealed : public Attribute
[<SealedAttribute>]
[<AttributeUsageAttribute(AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false,
Inherited = true)>]
type UpdateAttribute =
class
inherit Attribute
end
public final class UpdateAttribute extends Attribute
The UpdateAttribute type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() |
UpdateAttribute | Initializes a new instance of the UpdateAttribute class. |
Top
Properties
Name | Description | |
---|---|---|
![]() |
TypeId | (Inherited from Attribute.) |
![]() |
UsingCustomMethod | Gets or sets a value that indicates whether the method is a custom update operation. |
Top
Methods
Name | Description | |
---|---|---|
![]() |
Equals | (Inherited from Attribute.) |
![]() |
Finalize | (Inherited from Object.) |
![]() |
GetHashCode | (Inherited from Attribute.) |
![]() |
GetType | (Inherited from Object.) |
![]() |
IsDefaultAttribute | (Inherited from Attribute.) |
![]() |
Match | (Inherited from Attribute.) |
![]() |
MemberwiseClone | (Inherited from Object.) |
![]() |
ToString | (Inherited from Object.) |
Top
Explicit Interface Implementations
Name | Description | |
---|---|---|
![]() ![]() |
_Attribute.GetIDsOfNames | (Inherited from Attribute.) |
![]() ![]() |
_Attribute.GetTypeInfo | (Inherited from Attribute.) |
![]() ![]() |
_Attribute.GetTypeInfoCount | (Inherited from Attribute.) |
![]() ![]() |
_Attribute.Invoke | (Inherited from Attribute.) |
Top
Remarks
You apply the UpdateAttribute attribute to a method to indicate that the method is an update method, or to specify certain values for the update method. If your method matches the expected method signature for an update method, you do not have to apply the UpdateAttribute. The RIA Services framework will infer that a method with the expected update signature should be treated as an update. You apply the IgnoreAttribute to a method to prevent the RIA Services framework from generating a domain operation for that method.
The following shows the expected signature for the update method:
Return value |
None |
Parameters |
Entity |
Name Prefix |
Update, Change, or Modify |
Attribute |
[Update] (C#) -or- <Update()> (Visual Basic) |
Example |
public void UpdateProduct(Product product) (C#) -or- Public Sub UpdateProduct(ByVal product As Product) (Visual Basic) |
You set the UsingCustomMethod property to true to indicate that the update method is a named update method. You use a named update method when you need to add a custom operation that does not follow a simple modification pattern.
The following shows the expected signature for a named update method:
Return value |
None |
Parameters |
Entity Any number of other parameters |
Name Prefix |
Any name other than one starting with the prefixes for Insert, Update, or Delete |
Attribute |
[Update(UsingCustomMethod=true] (C#) -or- <Update(UsingCustomMethod:=True)> (Visual Basic) |
Example |
[Update(UsingCustomMethod=true] public void DiscountProduct(Product product, int percentage) (C#) -or- <Update(UsingCustomMethod:=True)> _ Public Sub DiscountProduct(ByVal product As Product, ByVal percentage As Integer) (Visual Basic) |
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.