skip to Main Content

I´m looking for books, tutorials or videos displaying best practices for consuming webservices. My main idea is to learn how to manage a user interface were results are pulled from many sources (eg: ebay developer, yahoo shopping xml, etc) and displayed to customers in a list of results. many years ago a website called www.mpire.com used to work in that way, displaying results on demand.

I´m developing with C#, razor, ef 4, sql server.
thanks in advance.

2

Answers


  1. Because invoking remote services is an I/O intensive tasks it would be beneficial to use asynchronous controllers. The documentation contains a couple of examples of howto put them in practice.

    Login or Signup to reply.
  2. Here is an overview. With this you can start searching more concepts on google.

    1. Learn how to connect to the various API’s and retrieve data. You can do this in your controller but it would be considered best practice to create a c# api wrapper for each of the api’s you are connecting to. Your application then can use the wrapper to simplify and seperate concerns. For many popular api’s .net wrappers are already created and are available on open source sites such as codeplex or github. The documentation for each api is a good place to start. Generally they will reference a wrapper for the language you are working in or may have developed there own you can download.

    2. Once you are retrieving data, then you have to consider if you are going to store the data in your app or if it is always going to call to the api to get the data. Depending on the situation, you can store the data in you database, thus making things faster and reducing calls to the external api. This doesn’t work / isn’t allowed in all situations but just depends on your use case. If you are going to save the data, you will need to learn about database persistance. Linq2sql is a good place to start because it is so easy. There are good examples on http://www.asp.net/mvc

    3. Depending on if you are retrieving the data from your database or from the API directly, you will then need to create custom view models for your views. In your controller, you can gather the data from the various sources and combine it into a single object called a view model. From there you pass the view model to your view and then display the data on the page. I would stay away from the asynchronous controllers until you get everything working properly and go into performance tuning. These will add complexity that you don’t need as you are learning.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search