DbExpressionBuilder.Property 方法 (DbExpression, String)

[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]

创建一个新的 DbPropertyExpression,它表示从给定实例中检索具有指定名称的实例属性。

命名空间:  System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder
程序集:  EntityFramework(在 EntityFramework.dll 中)

语法

声明
<ExtensionAttribute> _
Public Shared Function Property ( _
    instance As DbExpression, _
    propertyName As String _
) As DbPropertyExpression
用法
Dim instance As DbExpression 
Dim propertyName As String 
Dim returnValue As DbPropertyExpression 

returnValue = instance.Property(propertyName)
public static DbPropertyExpression Property(
    this DbExpression instance,
    string propertyName
)
[ExtensionAttribute]
public:
static DbPropertyExpression^ Property(
    DbExpression^ instance, 
    String^ propertyName
)
static member Property : 
        instance:DbExpression * 
        propertyName:string -> DbPropertyExpression
public static function Property(
    instance : DbExpression, 
    propertyName : String
) : DbPropertyExpression

参数

  • propertyName
    类型:System.String
    要检索的属性的名称。

返回值

类型:System.Data.Entity.Core.Common.CommandTrees.DbPropertyExpression
表示属性检索的一个新的 DbPropertyExpression。

使用说明

在 Visual Basic 和 C# 中,可以在 DbExpression 类型的任何对象上将此方法作为实例方法来调用。当使用实例方法语法调用此方法时,请省略第一个参数。有关详细信息,请参阅https://msdn.microsoft.com/zh-cn/library/bb384936(v=vs.113)https://msdn.microsoft.com/zh-cn/library/bb383977(v=vs.113)

异常

例外 条件
ArgumentNullException

propertyName 为 null,或者 instance 为 null 并且属性不是静态的。

ArgumentOutOfRangeException

没有具有指定名称的属性是由 instance 类型声明的。

请参阅

参考

DbExpressionBuilder 类

Property 重载

System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder 命名空间