DbExpressionBuilder.OfTypeOnly 方法

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

创建一个新的 DbOfTypeExpression,它生成一个集,该集由恰好属于指定类型的给定输入集的元素构成。

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

语法

声明
<ExtensionAttribute> _
Public Shared Function OfTypeOnly ( _
    argument As DbExpression, _
    type As TypeUsage _
) As DbOfTypeExpression
用法
Dim argument As DbExpression 
Dim type As TypeUsage 
Dim returnValue As DbOfTypeExpression 

returnValue = argument.OfTypeOnly(type)
public static DbOfTypeExpression OfTypeOnly(
    this DbExpression argument,
    TypeUsage type
)
[ExtensionAttribute]
public:
static DbOfTypeExpression^ OfTypeOnly(
    DbExpression^ argument, 
    TypeUsage^ type
)
static member OfTypeOnly : 
        argument:DbExpression * 
        type:TypeUsage -> DbOfTypeExpression
public static function OfTypeOnly(
    argument : DbExpression, 
    type : TypeUsage
) : DbOfTypeExpression

参数

返回值

类型:System.Data.Entity.Core.Common.CommandTrees.DbOfTypeExpression
具有指定的集参数和类型以及 OfTypeOnly 为 ExpressionKind 的一个新的 DbOfTypeExpression。

使用说明

在 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

argument 或 type 为 null。

ArgumentException

argument 不具有集合结果 type,或者类型所处于的类型层次结构与 argument 的集合结果类型的元素类型不同。

备注

DbOfTypeExpression 要求 argument 具有含多态元素类型的集合结果类型,且 type 是来自该元素类型所处类型层次结构的类型。

请参阅

参考

DbExpressionBuilder 类

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