C# Proxy Classes

Hi all! 

Here are all the proxy classes for the current data sets. 
(The links to the C# proxy classes have been relocated to the individual content providers’ page. You can access the pages via here.)

— 
Exploring CS file contents: 

I would advise everyone to peek into the CS file to see what it has. There are 2 main things to take note before using the class file namely the ‘Namespace’, ‘Entity Name’ and ‘Data Service URI’.

The ’Data Service URI’ is self explanatory. Taking Hungry Go Where as example, the value will be:
https://api.projectnimbus.org/hgwodataservice.svc/ 

Lets take Hungry-Go-Where’s CS File for example. At the very top of the file after the namespace, you will see this: 

partial class HGWEntities : global::System.Data.Services.Client.DataServiceContext 

In this case, our ‘Entity Name’ is “HGWEntities” 

In our next phase, we would be using ‘Namespace’, ‘Entity Name’ and ‘Data Service URI’ as reference to these mentioned in the current phase. 

Usage: 

  1. Include the cs file in your project.
  2. Create a new instance of the Entity.
    e.g; Namespace.EntityName newInstance = new Namespace.EntityName(new Uri(“Data Service URI”));
  3. Add a static void method to modify request headers,
    e.g;  private static void ModifyRequest(object sender, SendingRequestEventArgs e)
            {
                e.Request.Headers.Add(“AccountKey”, “AccountKeyHere“);
                e.Request.Headers.Add(“UniqueUserID”, Guid.NewGuid().ToString());
            }
    Note: You must change the AccountKey with your own Account Key value and you may choose to change the UniqueUserID to any GUID.
  4. Add an event handler to intercept the request before sending the request to the data service.
    e.g;  newInstance.SendingRequest += ModifyRequest;

You all all ready to go by now. :) Next is using the methods inside the newInstance which you have instantiated.

For Hungry Go Where, there is a collection named RestaurantSet (refer to data service uri: https://api.projectnimbus.org/hgwodataservice.svc/  ) so you can use it by simply calling ‘newInstance.RestaurantSet’ .

Have fun playing with the data service ;)

Advertisement
This entry was posted in Uncategorized. Bookmark the permalink.

13 Responses to C# Proxy Classes

  1. Pingback: Consuming Data Service in VS2010 « Project Nimbus

  2. Pingback: Datasets – Singapore Land Transport Authority (LTA) « Project Nimbus

  3. Pingback: Datasets – Singapore National Environment Agency (NEA) « Project Nimbus

  4. Pingback: Datasets – HungryGoWhere (HGW) « Project Nimbus

  5. Pingback: Datasets – National Library Board (NLB) « Project Nimbus

  6. Pingback: Datasets – Singapore Post (SP) « Project Nimbus

  7. Pingback: Datasets – ShowNearBy (SNB) « Project Nimbus

  8. Pingback: Datasets – Cinema Online (CO) « Project Nimbus

  9. Pingback: Datasets – Singapore Tourism Board (STB) « Project Nimbus

  10. Pingback: Datasets – Chlkboard (CHKB) | Project Nimbus

  11. Pingback: Datasets – User Contributed Content (USR) | Project Nimbus

  12. Pingback: Datasets – Chlkboard | Project Nimbus

  13. Pingback: Datasets – Places.sg | Project Nimbus

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s