如何使用实体框架获取行的序列号? [英] How to get sequence number of row using Entity Framework?

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

问题描述

我有SQL查询:

WITH OrderedRecs AS
(select ROW_NUMBER() OVER(ORDER BY RecID) as seqNumber,* from Records where RecordGroupID=7)
SELECT * FROM OrderedRecs where RecordID=35

如何使用实体框架获得相同的结果?

How do I get the same result using entity framework?

推荐答案

是否不能将SeqNumber添加为派生(或鉴别符) )列到基础实体? 请参阅前面的示例。您必须自己分配。

Couldn't you add SeqNumber as a derived (or discriminator) column to the base entity? See previous example. You would have to assign it yourself.

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

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