从表中获取最后的ID [Entity Framework] [英] Get Last ID From The table [ Entity Framework ]

查看:377
本文介绍了从表中获取最后的ID [Entity Framework]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以指导我这个。我使用EntityFramwork4,我想得到表的最后一行的ID。有人有使用这个经验告诉我,如何从数据库表中获取最后一个ID。

Could someone guide me on this. I am using EntityFramwork4 , I want to get the ID of the last row of a table. Could someone having experience using this tell me , how can i get the last id from a database table.

推荐答案

关系数据库没有内在顺序。没有最后一行这样的东西。即使有,多用户并发会使这个无意义。

Relational databases have no intrinsic order. There is no such thing as "the last row." Even if there were, multiuser concurrency would make this meaningless.

最大(id) 可能无法解决您的并发问题。但由于您尚未告诉我们您要解决的实际问题是什么,是,很难确定。

Max(id) probably doesn't solve your issue due to concurrency. But since you haven't told us what the real problem you're trying to solve is, it's hard to be sure.

这篇关于从表中获取最后的ID [Entity Framework]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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