Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Sinergija2013 ASP.NET Web API to the max

359 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Sinergija2013 ASP.NET Web API to the max

  1. 1. Radenko Zec Lanaco d.o.o ASP.NET Web API do maksimuma October 23rd 2013
  2. 2. O čemu pričamo i ne pričamo danas • ASP.NET Web API v1 • ASP.NET Web API v2 • Attribute routing • Owin self host (Katana) • IHttpActionResult • OData improvements...
  3. 3. Da li je ASP.NET Web API = RESTful service? ASP.NET Web API ne diktira stil arhitekture ali vi možete da razvijete RESTful service pomoću ASP.NET Web API- ja
  4. 4. ASP.NET Web API Web sajtovi Mobilni i tablet uređaji Web API Baza Drugi tipovi aplikacija
  5. 5. Richardson-ov model zrelosti REST-a
  6. 6. Rast Web API-ja
  7. 7. Koje metode podržava Web API ? Metod Akcija HTTPMetod Relativni URI Get Vraća listu svih kontakata GET /api/contacts Get Vraća kontakt na osnovu id-a GET /api/contacts/id Add Dodaje novi kontakt POST /api/contacts Update Mijenja selektovani kontakt PUT /api/contacts Delete Briše kontakt DELETE /api/contacts/id
  8. 8. Kako napraviti Web API? public class PersonController : ApiController { List<Person> _people; public PersonController() { _people = new List<Person>(); _people.AddRange(new Person[] { new Person { Id = 1, Name = "Chuck Norris" }, new Person { Id = 2, Name = "David Carradine" }, new Person { Id = 3, Name = "Bruce Lee" } });
  9. 9. Kako napraviti Web API? // GET /api/person public IEnumerable<Person> Get() { return _people; } // GET /api/person/5 public Person Get(int id) { return _people.First(x => x.Id == id); }
  10. 10. Rutiranje Web API-ja public static void RegisterRoutes(RouteCollection routes) { routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); }
  11. 11. Hosting i arhitektura
  12. 12. SilverReader • Ultra brz Web API • Korišten ASP.NET Web API v1
  13. 13. DEMO
  14. 14. Optimizacije • Westwind serijalizer • GZIP kompresija
  15. 15. Hvala na pažnji

×