本文整理汇总了C#中NetworkClient.CreatePool方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkClient.CreatePool方法的具体用法?C# NetworkClient.CreatePool怎么用?C# NetworkClient.CreatePool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkClient
的用法示例。
在下文中一共展示了NetworkClient.CreatePool方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FamilySearch
public ActionResult FamilySearch(string pid, string rid, string dir)
{
NetworkClient client = new NetworkClient(new DataProperties());
personRankConnectionPool = client.CreatePool(new ServerId[] { new ServerId("10.8.129.1:80") }, 60000, 60000);
queryProcessor = new QueryProcessor(personRankConnectionPool);
// Get the census year from database id
int censusYear = CensusHelper.GetCensusYear(int.Parse(rid));
// Get the previous/next census year
int databaseId = CensusHelper.GetDatabaseId(censusYear, dir);
if (databaseId == 0)
{
return new JsonResult
{
Data = string.Empty,
JsonRequestBehavior = JsonRequestBehavior.AllowGet
};
}
// Get the previous database id
int searchCensusYear = CensusHelper.GetCensusYear(databaseId);
QueryResultList results;
try
{
results = queryProcessor.ExecuteQuery(string.Format("{0}:{1}", pid, rid));
}
catch
{
return new JsonResult
{
Data = string.Empty,
JsonRequestBehavior = JsonRequestBehavior.AllowGet
};
}
List<SimpleFamily> familyResults = new List<SimpleFamily>();
List<Family> filteredResults = null;
//#region new approach
//foreach (QueryResult result in results)
//{
// if (result.Person.Id.DatabaseId == databaseId)
// {
// var familyList = results.PersonContainer.GetFamilies(result.Person.Id);
// if (familyList.Count > 1)
// {
// foreach (Family family in familyList)
// {
// SimpleFamily simpleFamily = new SimpleFamily();
// simpleFamily.Id = family.Id;
// simpleFamily.CensusYear = searchCensusYear;
// simpleFamily.Mother = SimplePerson.CreatePerson(results.PersonContainer.GetPerson(family.MotherId), simpleFamily.CensusYear);
// simpleFamily.Father = SimplePerson.CreatePerson(results.PersonContainer.GetPerson(family.FatherId), simpleFamily.CensusYear);
// foreach (RelationshipPointer child in family.Children.ChildPointers)
// {
// simpleFamily.Children.Add(SimplePerson.CreatePerson(results.PersonContainer.GetPerson(child.Id), simpleFamily.CensusYear));
// }
// simpleFamily.FindPerson(results);
// familyResults.Add(simpleFamily);
// }
// }
// else
// {
// SimpleFamily simpleFamily = new SimpleFamily();
// if (result.Person.Gender == GenderType.Female)
// {
// simpleFamily.Mother = SimplePerson.CreatePerson(result.Person, censusYear);
// }
// else
// {
// simpleFamily.Father = SimplePerson.CreatePerson(result.Person, censusYear);
// }
// familyResults.Add(simpleFamily);
// }
// }
//}
//return new JsonResult
//{
// Data = familyResults,
// JsonRequestBehavior = JsonRequestBehavior.AllowGet
//};
//#endregion
//////////////////////////////////////////////////////
filteredResults = results.PersonContainer.GetFamilies().Where(x => x.Id.Contains(databaseId.ToString())).Take(5).ToList();
//.........这里部分代码省略.........
示例2: RecordLink
public ActionResult RecordLink(string pid, string rid, string familyId, string compareFamilyId)
{
DefaultComparisonEngineConfigurationFileLocation = Path.Combine(Request.PhysicalApplicationPath, DefaultComparisonEngineConfigurationFileLocation);
NetworkClient client = new NetworkClient(new DataProperties());
personRankConnectionPool = client.CreatePool(new ServerId[] { new ServerId("10.8.129.1:80") }, 60000, 60000);
queryProcessor = new QueryProcessor(personRankConnectionPool);
// TODO: Send person id
int censusYear = CensusHelper.GetCensusYear(int.Parse(rid));
int databaseId = CensusHelper.GetDatabaseId(censusYear, "prev");
int searchCensusYear = CensusHelper.GetCensusYear(databaseId);
QueryResultList results;
try
{
results = queryProcessor.ExecuteQuery(string.Format("{0}:{1}", pid, rid));
}
catch
{
return new JsonResult
{
Data = string.Empty,
JsonRequestBehavior = JsonRequestBehavior.AllowGet
};
}
Family family = results.PersonContainer.GetFamilies().Where(x => x.Id == familyId).FirstOrDefault();
Family compareFamily = results.PersonContainer.GetFamilies().Where(x => x.Id == compareFamilyId).FirstOrDefault();
// TODO: loop through the family
IList<PersonModel.Person> personList = new List<PersonModel.Person>();
IList<PersonModel.Person> personList2 = new List<PersonModel.Person>();
foreach (RelationshipPointer child in family.Children.ChildPointers)
{
PersonModel.Person person = results.PersonContainer.GetPerson(child.Id);
foreach (RelationshipPointer compareChild in compareFamily.Children.ChildPointers)
{
PersonModel.Person comparePerson = results.PersonContainer.GetPerson(child.Id);
FeatureComparisonEngine comparisonEngine = new FeatureComparisonEngine(DefaultComparisonEngineConfigurationFileLocation);
ComparisonResult result = comparisonEngine.ComparePeople(results.PersonContainer, person, comparePerson);
}
}
return new JsonResult
{
Data = string.Empty,
JsonRequestBehavior = JsonRequestBehavior.AllowGet
};
}