- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一段代码将内存中的列表与数据库中保存的一些数据结合在一起。在我的单元测试中,这工作得很好(使用模拟的使用List的Linq2SqlRepository)。
public IRepository<OrderItem> orderItems { get; set; }
private List<OrderHeld> _releasedOrders = null;
private List<OrderHeld> releasedOrders
{
get
{
if (_releasedOrders == null)
{
_releasedOrders = new List<nOrderHeld>();
}
return _releasedOrders;
}
}
.....
public int GetReleasedCount(OrderItem orderItem)
{
int? total =
(
from item in orderItems.All
join releasedOrder in releasedOrders
on item.OrderID equals releasedOrder.OrderID
where item.ProductID == orderItem.ProductID
select new
{
item.Quantity,
}
).Sum(x => (int?)x.Quantity);
return total.HasValue ? total.Value : 0;
}
Exception information:
Exception type: System.NotSupportedException
Exception message: Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains() operator.
public int GetReleasedCount(OrderItem orderItem)
{
var releasedOrderIDs = releasedOrders.Select(x => x.OrderID);
int? total =
(
from item in orderItems.All
where releasedOrderIDs.Contains(item.OrderID)
&& item.ProductID == orderItem.ProductID
select new
{
item.Quantity,
}
).Sum(x => (int?)x.Quantity);
return total.HasValue ? total.Value : 0;
}
最佳答案
I'm guessing it's to do with the fact that orderItems is on the database and releasedItems is in memory.
关于Linq2SQL "Local sequence cannot be used in LINQ to SQL"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3132981/
给定一个 Sequence of Sequences 类型,如何将其转换为单个扁平化 Sequence 类型?考虑以下 Ceylon 代码: Integer[] range(Integer max)
出于学习目的,我正在尝试使用 F# 以序列形式运行模拟。从一系列随机数开始,如果状态不依赖于先前的状态,map 是生成状态序列的直接方法。我遇到问题的地方是当我尝试做类似的事情时: State(i+1
我正在 DynamoDB 上开发论坛。 有一个帖子表,其中包含线程中的所有帖子。我需要对帖子中的顺序有一个概念,即我需要知道哪个帖子先出现,哪个后出现。 我的服务将在分布式环境中运行。 我不确定使用时
我正在 DynamoDB 上开发论坛。 有一个帖子表,其中包含线程中的所有帖子。我需要对帖子中的顺序有一个概念,即我需要知道哪个帖子先出现,哪个后出现。 我的服务将在分布式环境中运行。 我不确定使用时
在 Z3 中,它支持 String 和 Sequence。但是 Z3py 是否也支持它们,或者我们必须使用 Python 中的字符串或列表?从最新的版本来看,新版本好像确实支持了String和Sequ
我是 Clojure 世界的新手,我遇到了一个问题。我得到了一个 LazySeq,看起来像这样(实际上更长) values = (("Brand1" "0") ("Brand2" "15") ("Br
我正在开发一个用于文本生成的序列到序列模型 ( paper )。我没有在解码器端使用“教师强制”,即 t0 时解码器的输出被馈送到 t1 时解码器的输入。 现在,实际上,解码器(LSTM/GRU)的输
Rust 中的规则是什么,类似于这里描述的规则http://en.cppreference.com/w/cpp/language/eval_order对于 C++? 目前我凭经验发现, 1) 函数的参
我当前的代码: import re from Bio.Seq import Seq def check_promoter(binding_element,promoter_seq): promoter
您好,此代码旨在存储使用 open cv 绘制的矩形的坐标,并将结果编译为单个图像。 import numpy as np import cv2 im = cv2.imread('1.jpg') im
在我的程序中,我有一个正则表达式,它确保输入字符串至少有一个字母和一个数字字符,并且长度在 2 到 10 之间。 Pattern p = Pattern.compile("^(?=.*\\d)(?=.
我正在查看 Google 的免费机器学习速成类(class),并尝试根据他们类(class)的第一部分制作一个预测模型。但是,在输入函数中,有一个字典,我不断收到此错误, in my_input_fn
我想使用 Boost 的 any_range 来处理多个异构数据范围。我的数据范围类型称为 fusion vector ,例如: typedef vector TypeSequence 鉴于这样的类型
我正在使用 SimpleJdbcInsert 作为, SimpleJdbcInsert simpleJdbcInsert = new SimpleJdbcInsert(dataSource).with
我正在尝试通过从我的数据创建 .phy 文件来创建系统发育树。 我有一个数据框 ndf= ESV trunc 1 esv1 TACGTAGGTG... 2 esv2 TACGGAGGGT... 3 e
这可能真的很简单,但我正处于 Rx 学习曲线的底部。我花了几个小时阅读文章、观看视频和编写代码,但我似乎对一些看起来应该非常简单的事情有心理障碍。 我正在从串行端口收集数据。我已使用 Observab
我正在将一些模块从 v8 迁移到 v10,我有这个模型: class SearchInfoPartnerSeniat(models.TransientModel): _name = "search.i
我尝试添加一个新的“自定义”序列到我的Marten DB中,以获取新用户的用户ID(在注册过程中)。。后来,我能够访问下一个序列值,如下所示:。问题出在上面的代码中:在第一次运行时:将userid_s
我在 rosettacode 遇到了这个代码 my @pascal = [1], { [0, |$_ Z+ |$_, 0] } ... Inf; .say for @pascal[^4]; # ==>
我不明白为什么这个程序有效: my $supply = Supply.interval: 1; react { whenever $supply { put "Got $^a" }
我是一名优秀的程序员,十分优秀!