ebook img

ASP.NET MVC 4 and the Web API: Building a REST Service from Start to Finish PDF

193 Pages·2013·1.84 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview ASP.NET MVC 4 and the Web API: Building a REST Service from Start to Finish

ASP.NET MVC 4 and the Web API Building a REST Service from Start to Finish Jamie Kurtz ASP.NET MVC 4 and the Web API Copyright © 2013 by Jamie Kurtzb This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in its current version, and permission for use must always be obtained from Springer. Permissions for use may be obtained through RightsLink at the Copyright Clearance Center. Violations are liable to prosecution under the respective Copyright Law. ISBN-13 (pbk): 978-1-43024977-1 ISBN-13 (electronic): 978-1-4302-4978-8 Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. President and Publisher: Paul Manning Lead Editor: Ewan Buckingham Development Editor: Matthew Moodie Technical Reviewer: Jeff Sanders Editorial Board: Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Louise Corrigan, Morgan Ertel, Jonathan Gennick, Jonathan Hassell, Robert Hutchinson, Michelle Lowman, James Markham, Matthew Moodie, Jeff Olson, Jeffrey Pepper, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Gwenan Spearing, Matt Wade, Tom Welsh Coordinating Editor: Jill Balzano Copy Editor: Patrick Meader Compositor: SPi Global Indexer: SPi Global Artist: SPi Global Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected] , or visit www.springeronline.com . Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation. [email protected] For information on translations, please e-mail , or visit www.apress.com . Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference www.apress.com/bulk- our Special Bulk Sales–eBook Licensing web page at sales . Any source code or other supplementary materials referenced by the author in this text is available to www.apress.com readers at . For detailed information about how to locate your book’s www.apress.com/source-code/ source code, go to . Dedicated to my wife, Kim. After nearly two decades together, she still manages to leave me speechless with her love, joy, peace, patience, kindness, goodness, faithfulness, gentleness, and self-control. Even as my work on this book has been fun and challenging, I know it is but an infinitesimal drop in the bucket of all that life has brought and will continue to bring us. Contents at a Glance Foreword About the Author About the Technical Reviewer Acknowledgments Chapter 1: ASP.NET MVC as a Service Framework Chapter 2: What is RESTful? Chapter 3: Designing the Sample REST API Chapter 4: Building the Environment and Creating the Source Tree Chapter 5: Controllers, Dependencies, and Managing the Database Unit of Work Chapter 6: Securing the Service Chapter 7: Putting It All Together Index Contents Foreword About the Author About the Technical Reviewer Acknowledgments Chapter 1: ASP.NET MVC as a Service Framework In the Land of JavaScript and Mobile Devices Advantages of Using the MVC Framework A Brief Introduction to the Web API Summary Chapter 2: What is RESTful? From RPC to REST XML-RPC and SOAP URIs and Resources HTTP Verbs HATEOAS HTTP Status Codes Summary Chapter 3 Designing the Sample REST API Task Management Resource Types Hypermedia Links Modeling the URIs and HTTP Verbs The Task–Management Data Model Choosing Architecture Components Data Access IoC Container Logger Authentication and Authorization Testing Framework Mocking Framework Build and Deployment Scripting Summary Chapter 4: Building the Environment and Creating the Source Tree Machine Configuration Windows 7 SP1 64 bit SQL Server 2012 Visual Studio 2012 NuGet Package Manager 2.1 Creating the Folder Structure Creating the Solution NuGet Config File Adding the Projects Basic Components DateTimeAdapter Domain Model Service Model Types Logging The Database Summary Chapter 5: Controllers, Dependencies, and Managing the Database Unit of Work Controller Activation Adding an HttpRequestMessage Argument Adding a Model Object Argument Dependencies Constructor Injection of Dependencies Configuring Ninject Dependency Injection Container Configuration Container Bindings IDependencyResolver for Ninject NHibernate Configuration and Mappings Database Configuration Model Mapping The Mapping Classes Project and File Organization Model Relationships Managing the Unit of Work Database Transaction Control Summary Chapter 6: Securing the Service The Main Idea Authentication Authorization The Authentication and Authorization Process Setting It Up Augmenting Membership Data The Message Handler IUserSession Summary Chapter 7: Putting It All Together A Quick Recap The Reference Data Controllers The PrioritiesController The CategoriesController Exploring the Controllers Using Fiddler Content Negotiation in the Web API Adding New Resources OData Support in the Web API The Task Controllers Separation of Subcontrollers Task Priority and Status Controllers The Task Categories and Users Controllers The Task Controller Sample Client Code Automatic Error Logging Summary Index

Description:
This one hundred page book focuses exclusively on how you can best use the ASP.NET MVC 4 Framework to build world-class REST services using the Web API. It sets aside much of what the ASP.NET MVC Framework can do, and focuses exclusively on how the Web API can help you build web services. You will n
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.