DataServiceContext.TryGetUri 方法
检索与指定实体关联的规范 URI(如果可用)。
命名空间: System.Data.Services.Client
程序集: Microsoft.Data.Services.Client(在 Microsoft.Data.Services.Client.dll 中)
语法
声明
Public Function TryGetUri ( _
entity As Object, _
<OutAttribute> ByRef identity As Uri _
) As Boolean
用法
Dim instance As DataServiceContext
Dim entity As Object
Dim identity As Uri
Dim returnValue As Boolean
returnValue = instance.TryGetUri(entity, _
identity)
public bool TryGetUri(
Object entity,
out Uri identity
)
public:
bool TryGetUri(
Object^ entity,
[OutAttribute] Uri^% identity
)
member TryGetUri :
entity:Object *
identity:Uri byref -> bool
public function TryGetUri(
entity : Object,
identity : Uri
) : boolean
参数
- entity
类型:System.Object
由 identity 标识的实体。
- identity
类型:System.Uri%
实体的 URI。
返回值
类型:System.Boolean
如果在输出参数中返回规范 URI,则返回 true。如果指定实体不由 DataServiceContext 跟踪或处于已添加状态,则没有可用的 URI,因此会返回 false。
异常
异常 | 条件 |
---|---|
ArgumentNullException | 当 entity 为 nullnull 引用(在 Visual Basic 中为 Nothing) 时。 |
注释
处于 Added 状态的对象尚未有 URI。