-
Notifications
You must be signed in to change notification settings - Fork 2
Background
Over the last couple of years we’ve seen a dramatic increase in usage of the NetServer Web Services in the software we develop at InfoBridge. Especially now we’ve focused new development more and more on SuperOffice CRM Online.
The Web Services are great at performing CRUD operations but searching for data is a bit tedious. You can choose from either FindAgent or the ArchiveAgent but they both require quite some code to get going:
using (ArchiveAgent aa = new ArchiveAgent())
{
ArchiveListItem[] results = aa.GetArchiveListByColumns("person", //providerName
new[] { "personId", "fullName" }, //columns
new[] { new ArchiveOrderByInfo { Name = "fullName", Direction = OrderBySortType.ASC } }, //order
new[] { new ArchiveRestrictionInfo("contactId", "=", "2") }, //restrictions
new[] { "person" }, //entities
0, //page
10); //page size
foreach (ArchiveListItem item in results)
{
int personId = CultureDataFormatter.ParseEncodedInt(item.ColumnData["personId"].DisplayValue);
string name = item.ColumnData["personId"].DisplayValue;
}
Dealing with multiple criteria and especially nested criteria (using parentheses) complicate things further.
To handle searching in a more elegant way we have written several libraries. First just for making parsing of the results a bit easier, but in later iterations we added features to simplify building the actual ‘queries’ as well. As every .NET developer we love LINQ so in one of the latest iterations we added a custom LINQ provider to the library as well, which makes searching so much easier.
A while ago we realized that this library could also be really useful for other developers so in an effort to give back to the SuperOffice community we decided to turn the project into an open source library and make it publicly available and free to use.