2
我遇到了一个问题,我的程序创建分区但不查询每个分区。我必须使用分区的原因是因为我正在为我的服务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);
}
}
而第一个分区都不会被跳过,而不是addedd。
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;
}
是否正确划分政策号码之外加上政策?尽管有多个保单号码,它是否只查询一个保单号码? –
它确实正确地分区策略。让我添加一个编辑 –