DataServiceContext.Detach 方法
从 DataServiceContext 所跟踪的实体列表中移除该实体。
命名空间: System.Data.Services.Client
程序集: Microsoft.Data.Services.Client(在 Microsoft.Data.Services.Client.dll 中)
语法
声明
Public Function Detach ( _
entity As Object _
) As Boolean
用法
Dim instance As DataServiceContext
Dim entity As Object
Dim returnValue As Boolean
returnValue = instance.Detach(entity)
public bool Detach(
Object entity
)
public:
bool Detach(
Object^ entity
)
member Detach :
entity:Object -> bool
public function Detach(
entity : Object
) : boolean
参数
- entity
类型:System.Object
将从 DataServiceContext 中分离的被跟踪实体。
返回值
类型:System.Boolean
如果指定的实体已分离,则返回 true;否则返回 false。
异常
异常 | 条件 |
---|---|
ArgumentNullException | 当 entity 为 nullnull 引用(在 Visual Basic 中为 Nothing) 时。 |
注释
对象一旦分离,就不再由 DataServiceContext 跟踪。
可以调用 Detach 方法分离任何对象,而不管其 EntityStates 如何。
分离指定实体后,此方法还将分离与该实体相关的任何链接。