洗牌集合和无法理解如何翻译 NewGuid()
shuffling collection and Cannot understand how to translate NewGuid()
我有以下查询
var nrOfRetrievedDocs = new List<RetrievedDocs>().Count();
_docs= RavenSession.Query<DocsToProcess>().Skip(nrOfRetrievedDocs)
.OrderBy(x=>Guid.NewGuid()).Take(1024).ToList();
我正在
An exception of type 'System.InvalidOperationException' occurred in
Raven.Client.Lightweight.dll but was not handled in user code
Additional information: Cannot understand how to translate NewGuid()
我想在随机位置随机播放集合和 select 1024 个对象。
为什么我会遇到这个 Cannot understand how to translate NewGuid()
以及如何克服这个问题,是否有更好(更快)的方法来 select 集合中的随机项目?
如果你想随机排序,你可以直接这样做,而不是像这样:
List<Employee> results = session.Query<Employee>()
.Customize(x => x.RandomOrdering())
.Where(x => x.FirstName == "Robert")
.ToList();
我有以下查询
var nrOfRetrievedDocs = new List<RetrievedDocs>().Count();
_docs= RavenSession.Query<DocsToProcess>().Skip(nrOfRetrievedDocs)
.OrderBy(x=>Guid.NewGuid()).Take(1024).ToList();
我正在
An exception of type 'System.InvalidOperationException' occurred in Raven.Client.Lightweight.dll but was not handled in user code
Additional information: Cannot understand how to translate NewGuid()
我想在随机位置随机播放集合和 select 1024 个对象。
为什么我会遇到这个 Cannot understand how to translate NewGuid()
以及如何克服这个问题,是否有更好(更快)的方法来 select 集合中的随机项目?
如果你想随机排序,你可以直接这样做,而不是像这样:
List<Employee> results = session.Query<Employee>()
.Customize(x => x.RandomOrdering())
.Where(x => x.FirstName == "Robert")
.ToList();