DbEntityEntry<TEntity>.Reference<TProperty> 方法 (Expression<Func<TEntity, TProperty>>)
[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]
获取一个对象,该对象表示从该实体到其他实体的引用 (即非集合)导航属性。
命名空间: System.Data.Entity.Infrastructure
程序集: EntityFramework(在 EntityFramework.dll 中)
语法
声明
<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")> _
Public Function Reference(Of TProperty As Class) ( _
navigationProperty As Expression(Of Func(Of TEntity, TProperty)) _
) As DbReferenceEntry(Of TEntity, TProperty)
用法
Dim instance As DbEntityEntry
Dim navigationProperty As Expression(Of Func(Of TEntity, TProperty))
Dim returnValue As DbReferenceEntry(Of TEntity, TProperty)
returnValue = instance.Reference(navigationProperty)
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public DbReferenceEntry<TEntity, TProperty> Reference<TProperty>(
Expression<Func<TEntity, TProperty>> navigationProperty
)
where TProperty : class
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1006:DoNotNestGenericTypesInMemberSignatures")]
public:
generic<typename TProperty>
where TProperty : ref class
DbReferenceEntry<TEntity, TProperty>^ Reference(
Expression<Func<TEntity, TProperty>^>^ navigationProperty
)
[<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")>]
member Reference :
navigationProperty:Expression<Func<'TEntity, 'TProperty>> -> DbReferenceEntry<'TEntity, 'TProperty> when 'TProperty : not struct
JScript does not support generic types and methods.
类型参数
- TProperty
属性的类型。
参数
- navigationProperty
类型:System.Linq.Expressions.Expression<Func<TEntity, TProperty>>
表示导航属性的表达式。
返回值
类型:System.Data.Entity.Infrastructure.DbReferenceEntry<TEntity, TProperty>
表示导航属性的对象。