Compartilhar via


ObjectContextExtensions.AttachAsModified<T> Method (ObjectSet<T>, T)

[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.]

Attaches the specified entity as modified.

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

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Sub AttachAsModified(Of T As Class) ( _
    objectSet As ObjectSet(Of T), _
    entity As T _
)
'Usage
Dim objectSet As ObjectSet(Of T)
Dim entity As T

objectSet.AttachAsModified(entity)
public static void AttachAsModified<T>(
    this ObjectSet<T> objectSet,
    T entity
)
where T : class
[ExtensionAttribute]
public:
generic<typename T>
where T : ref class
static void AttachAsModified(
    ObjectSet<T>^ objectSet, 
    T entity
)
static member AttachAsModified : 
        objectSet:ObjectSet<'T> * 
        entity:'T -> unit  when 'T : not struct
JScript does not support generic types and methods.

Type Parameters

  • T
    The entity type.

Parameters

  • entity
    Type: T
    The current entity state.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ObjectSet<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see or .

Exceptions

Exception Condition
ArgumentNullException

objectSet or entity is nulla null reference (Nothing in Visual Basic).

Remarks

This method can be used in cases where the entity has a Timestamp member.

See Also

Reference

ObjectContextExtensions Class

AttachAsModified Overload

System.ServiceModel.DomainServices.EntityFramework Namespace