130 likes | 260 Views
REST with Silverlight 5, WCF ASP.NET Web API, and a little MVC 4. (AKA: Let’s see how many product names will fit in a session title) (or, the live version of part of chapters 21 and 22 of Silverlight 5 in Action). Where to find help. Our Community Sites silverlight.net windowsclient.net
E N D
REST with Silverlight 5, WCF ASP.NET Web API, and a little MVC 4 (AKA: Let’s see how many product names will fit in a session title)(or, the live version of part of chapters 21 and 22 of Silverlight 5 in Action)
Where to find help • Our Community Sites • silverlight.net • windowsclient.net • asp.net • dev.windows.com • MSDN: msdn.microsoft.com • My Blog: 10rem.net • Will include any updated source/examples
REST in a Nutshell • REpresentationalState Transfer • Relies on verbs • Primarily GET, PUT, POST, DELETE • The architecture of the web
What RESTful Services get you • Instantly accessible to any client which can make web requests • No need for client proxies, stubs, envelopes and the other stuff we have to deal with • Especially important with the proliferation of connected microcontrollers • Cacheable using normal web-aware mechanisms • Scalable for the same reason • Flexible if you go with a full hypermedia approach
WCF ASP.NET Web API • An API that supports you in building RESTful APIs • Does not impose REST constraints • Does not get in your way • Architected to rely on and exploit HTTP fully, not just as a generic transport • Written by the WCF Team at Microsoft. • Now available as part of ASP.NET MVC 4
This Example Serves Silverlight Client ASP.NET MVC Data ASP.NET Web API Uses Primarily focus on the Silverlight client and Web API Server.
Project • Internal corporate application • Shared across many divisions • Control some, but not all, clients • Goals and constraints • Use RESTful approaches to make API available to as many clients as possible • No fat Soap envelope • No proprietary WCF formats • Make it really easy for Silverlight (or other owned clients) to use the resources • Don’t want to recreate entities • For V1, don’t worry about security (Boy, was that convenient!)
Stuff with semicolons and curly braces … and the occasional angle bracket DEMO
Summary • Web API for RESTful “services” • Web API Now part of ASP.NET MVC • Silverlight + MVC play together nicely • Create a Razor helper for hosting Silverlight • Linked files to share model definitions • Conditional compilation or partial classes for platform-specific features • My book has awesome demos
Where to find help • Our Community Sites • silverlight.net • windowsclient.net • asp.net • dev.windows.com • MSDN: msdn.microsoft.com • My Blog: 10rem.net • Will include any updated source/examples • Twitter: @pete_brown • Mail pete.brown@microsoft.com