未从分区中获取所有结果
本文关键字:结果 获取 分区 | 更新日期: 2023-09-27 18:29:14
我的程序在创建分区但没有查询每个分区时遇到问题。我必须使用分区的原因是,我正在为我的服务api创建一个Odata查询字符串,如果我一次查询超过55个策略,则查询字符串会变得太长而失败。我可以看到我的应用程序在哪里将策略划分为不同的分区,但这是它的极限。它查询其中一个,然后不为另一个做任何事情。谢谢你的帮助。
**编辑一旦它分区,它就在这里
public void GetAllEligibleUnredeemedPoliciesForEachActiveAgentCodeForTheAgent()
{
AgentPoliciesForEachAgentCode = new List<DtoApp2LeadPolicy>();
foreach (var agentCode in _app2Agent.AllOfTheAgentCodesForTheAgent)
{
if (AgentPolicies != null)
AgentPolicies = new List<DtoApp2LeadPolicy>();
SetTheAgentCode(agentCode);
SetAgentPolicyNumbersByAgentCode();
SetAllPolicyNumbersByAgentsEligiblePolicies();
SetAgentPoliciesFromAtlamServices();
if (AgentPolicies != null) AgentPoliciesForEachAgentCode.AddRange(AgentPolicies);
}
}
并且第一个分区被跳过而不被添加。
public void PartitionThePolicyNumbers()
{
PartitionsOfPolicyNumbers = AllPolicyNumbers.Partition<string>( NumberOfPolicyNumberPartitions);
}
public void QueryTheWebServicesForEligiblePolicyDtosUsingEachPartition()
{
foreach
(var partition in PartitionsOfPolicyNumbers)
{
SetThePolicyNumbersForThePartition(partition);
SetAgentPolicyDtosFromWebServices();
SetPoliciesForAgentView();
AddEligiblePolicyDtosFromWebServicesCallToAllEligiblePoliciesForAgent();
}
}
public void SetThePolicyNumbersForThePartition(IEnumerable<string> policyNumbers)
{
this.PolicyNumbers = policyNumbers;
}
public void AddEligiblePolicyDtosFromWebServicesCallToAllEligiblePoliciesForAgent()
{
if (AllEligiblePoliciesForAgentView == null) AllEligiblePoliciesForAgentView = new List<DtoApp2LeadPolicy>();
foreach (var policyDto in _app2Lead.AgentPolicies)
{
AllEligiblePoliciesForAgentView.Add(policyDto);
}
}
public void SetNumberOfPartitionsForPolicyNumbers()
{
NumberOfPolicyNumberPartitions = CalculateNumberOfPolicyNumberPartitions();
}
public int CalculateNumberOfPolicyNumberPartitions()
{
var numberOfPolicyNumbers = AllPolicyNumbers.Count();
if (numberOfPolicyNumbers < 55) return 1;
return (numberOfPolicyNumbers / 55) + 1;
}
为每个代码方法创建在Agentpolicy之外添加策略的方法
public void AddAgentPolicies()
{
if (AgentPolicies != null) AgentPoliciesForEachAgentCode.AddRange(AgentPolicies);
}