Get Last ID From The table [ Entity Framework ]

99封情书 提交于 2019-12-06 14:12:58

问题


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.


回答1:


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.

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.



来源:https://stackoverflow.com/questions/3975520/get-last-id-from-the-table-entity-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!