ObjectQuery<T>.OfType<TResultType> 方法
[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]
将查询限制为仅包括特定类型的结果。
命名空间: System.Data.Entity.Core.Objects
程序集: EntityFramework(在 EntityFramework.dll 中)
语法
声明
Public Function OfType(Of TResultType) As ObjectQuery(Of TResultType)
用法
Dim instance As ObjectQuery
Dim returnValue As ObjectQuery(Of TResultType)
returnValue = instance.OfType()
public ObjectQuery<TResultType> OfType<TResultType>()
public:
generic<typename TResultType>
ObjectQuery<TResultType>^ OfType()
member OfType : unit -> ObjectQuery<'TResultType>
JScript does not support generic types and methods.
类型参数
- TResultType
使用应用筛选器执行查询时,ObjectResult<T> 的类型返回。
返回值
类型:System.Data.Entity.Core.Objects.ObjectQuery<TResultType>
一个新的 ObjectQuery<T> 实例,等效于应用了 OFTYPE 的原始实例。
异常
例外 | 条件 |
---|---|
EntitySqlException | 指定的类型无效。 |