Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Diving into the Deep With ASP.NET

Diving into the Deep With ASP.NET

A talk I gave at Twin Cities Code Camp on April 27, 2013. I talked about various Web API topics and shared code from my closed source project, Keep Track of My Games (http://keeptrackofmygames.com).

The notes and links can be found in this post: http://kamranicus.com/Blog/Posts/73/slides-and-resources-for-tccc14-web-api-talk

Kamran Ayub

April 27, 2013
Tweet

More Decks by Kamran Ayub

Other Decks in Programming

Transcript

  1. DIVING INTO THE DEEP WITH ASP .NET WEB API @kamranayub

    Cannonball - Luis Martins, from The Noun Project
  2. < > gaming coding Attribution: Code - Nikhil Dev,, Video

    Game Controller - 42, Batman - Ilias Ismanalijev, French Fries - Stephanie Wauters, - from The Noun Project metal-ing learning eating *i wish. vigilante-ing*
  3. TOPICS FOR DISCUSSION Debugging & Performance Logging Dependency Injection Authorization

    & Authentication Anti-Forgery Custom Routing Exception Handling Async Tasks Multi-Platform Consumption Versioning
  4. HTTP Authorization Web API supports action filters just like MVC

    In this case, I’ve implemented a custom System.Web.Http.AuthorizeAttribute named HttpRequireProfile that checks my database for the logged-in user
  5. public async Task ViewPresentation() { return await _presenter.IsFunny(); } (Like

    that’ll ever finish executing amirite) Doesn’t serve a “real” purpose Generates a state machine NOT void* *except in certain cases
  6. 3 users 60 second load ~7000 requests Async makes a

    difference. About 36% in this instance, but not every call benefits from awaiting. Sync Async Difference # Requests 4354 6890 +36% Avg Requests/s 71.59 113 +36% Avg Response (ms) 42ms 26ms -61%
  7. And let’s not forget C#! Yes, that’s 5 lines of

    actual code! No configuration No XML No WCF
  8. Someone also wants to add semantic versioning to Attribute Routing

    (no, it wasn’t me) Not sure about Web API support, though (Maybe I’ll go add it…)
  9. Recommended Libraries • Javascript • Underscore.js • TrafficCop.js • Knockout.js

    • Moment.js or Date.js • URI.js • .NET • Attribute Routing • DotNotOpenAuth (or WorldDomination.Web.Auth) • Common Logging • Ninject • ActionMailer • Cassette • FluentValidation • MiniProfiler • PerfIt • Westwind.RazorHosting
  10. Thanks! Hopefully you learned a thing or two about using

    Web API I also hope you saw how awesome it is, even with complex problems @kamranayub kamranicus.com