English 中文(简体)
将实体从背景中删除,需要3条电话?
原标题:Updating an entity object out of context requires 3 calls?
  • 时间:2012-01-12 20:09:00
  •  标签:
  • linq

Scenario: I query for a record in a database using linq to entities. So I open a data context, do my linq query, and pass the returned object off to my business logic layer / presentation layer.

项目从介绍层得到更新,并发生了一场节日活动,我把实体转回弹片。

在我的奖章中,我不得不打开一个新的背景,对我想要更新的物体进行lin问,利用我通过的实体更新归还的记录,然后是“SaveChanges()”。

我这样做了吗? 如果我使用ADO I,似乎只需要提供2个数据库,即初步选择和更新。 现在我不得不做3次电话(2次选择,1次更新)? 种子效率低下。 评论? 我希望它们在今后版本中能够改进,因为这可能是业绩高估的一大缺陷。

问题回答

自你重新使用“拯救儿童”以来,我假定你重新使用实体框架。 如果是这样的话,你就应当能够仅附上你返回的实体。

确实,这是世界家庭联合会的农业、林业和林业局如何运作。





相关问题
IEnumerable to array of parameter

Using linq? and XML is there a way to convert this IEnumerable to a string array of the value parameter? List<string> idList = new List<string>(); foreach (XElement idElement in word....

linq query for tag system - search for multiple tags

I have two tables, Tags(tagid, postid, tagname) and posts(postid, name, ...) now i want to make a query that returns me all posts that have a generic amount of tags. like: i want all posts that have ...

Linq operations against a List of Hashtables?

I m working with a set of legacy DAO code that returns an IList, where each Hashtable represents the row of a dynamically executed SQL query. For example, the List might contain the following records/...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

How to filter duplicate list items

i have list of items IList with data that looks list this: GenId TestMode 1 0 1 1 3 0 3 1 4 NULL 2 NULL i want to remove the index ...

C# Grouping/Sorting a Generic List<> using LINQ

Im looking to group and sort a Generic List<>. I have a list of objects representing files and each of these objects has a FileName, FileType and FileDate property. FileType is defined as an ...

热门标签