Batching is implemented in the .NET Facebook API Client similarly to how it is done in the official Java client:
using a batch.
public class DemoController : FacebookMvcController
{
public ActionResult Users()
{
using (var batch = Batch.Start(this.FbContext))
{
var uids = new String[] { this.FbContext.Session.Uid.ToString() };
var fields = new String[] { "first_name", "last_name" };
var standardFields = new String[] { "first_name", "last_name", "name", "timezone",
"birthday", "sex", "affiliations", "locale", "profile_url", "proxied_email" };
var getInfoResponse = this.FbContext.Users.GetInfo(uids, fields);
var getLoggedInUserResponse = this.FbContext.Users.GetLoggedInUser();
var getStandardInfoResponse = this.FbContext.Users.GetStandardInfo(uids, standardFields);
var hasEmailPermissionResponse = this.FbContext.Users.HasAppPermission("email");
var hasOfflineAccessPermissionResponse = this.FbContext.Users.HasAppPermission("offline_access");
var hasStatusUpdatePermissionResponse = this.FbContext.Users.HasAppPermission("status_update");
var hasPhotoUploadPermissionResponse = this.FbContext.Users.HasAppPermission("photo_upload");
var hasCreateListingPermissionResponse = this.FbContext.Users.HasAppPermission("create_listing");
var hasCreateEventPermissionResponse = this.FbContext.Users.HasAppPermission("create_event");
var hasRsvpEventPermissionResponse = this.FbContext.Users.HasAppPermission("rsvp_event");
var hasSmsPermissionResponse = this.FbContext.Users.HasAppPermission("sms");
var hasShareItemPermissionResponse = this.FbContext.Users.HasAppPermission("share_item");
batch.Complete();
return View(new UsersIndexData
{
GetInfo = getInfoResponse.Value,
GetLoggedInUser = getLoggedInUserResponse.Value,
GetStandardInfo = getStandardInfoResponse.Value,
HasEmailPermission = hasEmailPermissionResponse.Value,
HasOfflineAccessPermission = hasOfflineAccessPermissionResponse.Value,
HasStatusUpdatePermission = hasStatusUpdatePermissionResponse.Value,
HasPhotoUploadPermission = hasPhotoUploadPermissionResponse.Value,
HasCreateListingPermission = hasCreateListingPermissionResponse.Value,
HasCreateEventPermission = hasCreateEventPermissionResponse.Value,
HasRsvpEventPermission = hasRsvpEventPermissionResponse.Value,
HasSmsPermission = hasSmsPermissionResponse.Value,
HasShareItemPermission = hasShareItemPermissionResponse.Value
});
}
}
is called. At that point, the results of all the calls are populated and can be consumed.