1

我有以下查询。在其中,我正在执行 Take(2100) 以避免施加 2100 rpc 限制。

 var query =
     from result in staging_sparc_sophis_trade.AsQueryable()
     where deals.Take(2100).Contains(result.TRADE_ID)
     select new traded_product()
     {                   
        Deal = result.TRADE_ID,
        CostCentre = result.FTP_COSTCTR,
       InvolvedPartyId = R_GEN_002(result.hsbc_source_system_instance, "", result.CNPTY_ACRONYM
     };

我想知道的是,有没有一种方法可以删除 Take(2100) 部分并将其替换为 Deal 行中的 lambda 语句,以检查交易是否在我正在搜索的列表(交易)中?

4

1 回答 1

1

我找到了解决问题的两种方法。解决方法 1、如果我直接在SqlServer物理机上运行查询,不会出现问题。

在下一部分中进行过滤:删除“Where 子句”

var query =
 from result in staging_sparc_sophis_trade.AsQueryable()
 --where deals.Take(2100).Contains(result.TRADE_ID)
 select new traded_product()
 {                   
    Deal = result.TRADE_ID,
    CostCentre = result.FTP_COSTCTR,
   InvolvedPartyId = R_GEN_002(result.hsbc_source_system_instance, "", result.CNPTY_ACRONYM
 };

在这部分代码中添加过滤部分。它运行得有点慢,但仍然有效。我认为它运行速度较慢,因为我在每次迭代中都在搜索完整列表。

foreach (var result in query)
{
if (!deals.contains(result.TRADE_ID))
{
--Actions
}
}
于 2013-10-10T10:09:29.883 回答