使用实体框架 [英] Working with Entity Framework

查看:70
本文介绍了使用实体框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候



我的问题是关于使用实体框架。假设我有一个Entity数据模型,我有一个dbconext实例,

 dbcontext.EntityName.ExtensionMethodName(lambda expression)

 dbcontext.EntityName.Local.ExtensionMethodName(lambda表达式)

解决方案

本地版本仅适用于已经存在的实体加载到上下文中。如果它还没有加载,它将不会从数据库中获取它。非本地人将。


请参考:使用本地查看本地数据 [ ^ ]和这: DbSet(Of TEntity).Local Property [ ^ ]

Greetings

My question is about working with the Entity Framework. Lets say I am having an Entity data model and I am having a dbconext instance what is the difference between

dbcontext.EntityName.ExtensionMethodName(lambda expression)

and

dbcontext.EntityName.Local.ExtensionMethodName(lambda expression)

解决方案

The local version only works on an entity that is already loaded into the context. If it hasn't been loaded yet, it will NOT go get it from the database. The non-local one will.


Please, refer this: Using Local to look at local data[^] and this: DbSet(Of TEntity).Local Property[^]


这篇关于使用实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆