Freeman | Pro ASP.NET MVC 5 | E-Book | sack.de
E-Book

E-Book, Englisch, 812 Seiten, eBook

Freeman Pro ASP.NET MVC 5

E-Book, Englisch, 812 Seiten, eBook

ISBN: 978-1-4302-6530-6
Verlag: APRESS
Format: PDF
Kopierschutz: Wasserzeichen (»Systemvoraussetzungen)



The ASP.NET MVC 5 Framework is the latest evolution of Microsoft’s ASP.NET web platform. It provides a high-productivity programming model that promotes cleaner code architecture, test-driven development, and powerful extensibility, combined with all the benefits of ASP.NET.ASP.NET MVC 5 contains a number of advances over previous versions, including the ability to define routes using C# attributes and the ability to override filters. The user experience of building MVC applications has also been substantially improved. The new, more tightly integrated, Visual Studio 2013 IDE has been created specifically with MVC application development in mind and provides a full suite of tools to improve development times and assist in reporting, debugging and deploying your code. The popular Bootstrap JavaScript library has also now been included natively within MVC 5 providing you, the developer, with a wider range of multi-platform CSS and HTML5 options than ever before without the penalty of having to load-in third party libraries.
Freeman Pro ASP.NET MVC 5 jetzt bestellen!

Zielgruppe


Popular/general


Autoren/Hrsg.


Weitere Infos & Material


1;Contents at a Glance;3
2;Contents;794
3;About the Author;811
4;About the Technical Reviewer;812
5;Chapter 1: Putting ASP.NET MVC in Context;5
5.1;Understanding the History of ASP.NET;5
5.1.1;What Is Wrong with ASP.NET Web Forms?;6
5.2;Web Development Today;7
5.2.1;Web Standards and REST;7
5.2.2;Agile and Test-Driven Development;7
5.2.3;Ruby on Rails;8
5.2.4;Node.js;8
5.3;Key Benefits of ASP.NET MVC;9
5.3.1;MVC Architecture;9
5.3.2;Extensibility;9
5.3.3;Tight Control over HTML and HTTP;10
5.3.4;Testability;10
5.3.5;Powerful Routing System;11
5.3.6;Built on the Best Parts of the ASP.NET Platform;11
5.3.7;Modern API;11
5.3.8;ASP.NET MVC Is Open Source;12
5.4;What Do I Need to Know?;12
5.5;What Is the Structure of This Book?;12
5.5.1;Part 1: Introducing ASP.NET MVC 5;12
5.5.2;Part 2: ASP.NET MVC in Detail;12
5.6;What’s New in this Edition?;13
5.7;Where Can I Get the Example Code?;13
5.8;What Software Do I Need for This Book?;14
5.9;Credits;14
5.10;Summary;14
6;Chapter 2: Your First MVC Application;15
6.1;Preparing Visual Studio;15
6.2;Creating a New ASP.NET MVC Project;15
6.2.1;Adding the First Controller;19
6.2.2;Understanding Routes;23
6.3;Rendering Web Pages;23
6.3.1;Creating and Rendering a View;23
6.3.2;Adding Dynamic Output;27
6.4;Creating a Simple Data-Entry Application;29
6.4.1;Setting the Scene;29
6.4.2;Designing a Data Model;30
6.4.2.1;Adding a Model Class;30
6.4.3;Linking Action Methods;31
6.4.3.1;Creating the Action Method;32
6.4.3.2;Adding a Strongly Typed View;33
6.4.4;Building the Form;34
6.4.5;Setting the Start URL;36
6.4.6;Handling Forms;37
6.4.6.1;Using Model Binding;39
6.4.6.2;Rendering Other Views;39
6.4.7;Adding Validation;40
6.4.7.1;Highlighting Invalid Fields;43
6.4.8;Styling the Content;46
6.4.8.1;Using NuGet to Install Bootstrap;46
6.4.8.2;Styling the Index View;47
6.4.8.3;Styling the RsvpForm View;48
6.4.8.4;Styling the Thanks View;50
6.4.9;Completing the Example;52
6.5;Summary;53
7;Chapter 3: The MVC Pattern;54
7.1;The History of MVC;54
7.2;Understanding the MVC Pattern;54
7.2.1;Understanding the Domain Model;55
7.2.2;The ASP.NET Implementation of MVC;55
7.2.3;Comparing MVC to Other Patterns;56
7.2.3.1;Understanding the Smart UI Pattern;56
7.2.3.2;Understanding the Model-View Architecture;57
7.2.3.3;Understanding Classic Three-Tier Architectures;58
7.2.3.4;Understanding Variations on MVC;58
7.2.3.4.1;Understanding the Model-View-Presenter Pattern;58
7.2.3.4.2;Understanding the Model-View-View Model Pattern;59
7.3;Building Loosely Coupled Components;59
7.3.1;Using Dependency Injection;60
7.3.1.1;Breaking and Declaring Dependencies;61
7.3.1.2;Injecting Dependencies;61
7.3.2;Using a Dependency Injection Container;62
7.4;Getting Started with Automated Testing;63
7.4.1;Understanding Unit Testing;63
7.4.1.1;Using TDD and the Red-Green-Refactor Workflow;67
7.4.2;Understanding Integration Testing;68
7.5;Summary;69
8;Chapter 4: Essential Language Features;70
8.1;Preparing the Example Project;70
8.1.1;Adding the System.Net.Http Assembly;72
8.2;Using Automatically Implemented Properties;72
8.3;Using Object and Collection Initializers;75
8.4;Using Extension Methods;77
8.4.1;Applying Extension Methods to an Interface;79
8.4.2;Creating Filtering Extension Methods;82
8.5;Using Lambda Expressions;83
8.6;Using Automatic Type Inference;87
8.7;Using Anonymous Types;87
8.8;Performing Language Integrated Queries;89
8.8.1;Understanding Deferred LINQ Queries;93
8.9;Using Async Methods;94
8.9.1;Applying the async and await Keywords;96
8.10;Summary;97
9;Chapter 5: Working with Razor;98
9.1;Preparing the Example Project;98
9.1.1;Defining the Model;98
9.1.2;Defining the Controller;99
9.1.3;Creating the View;100
9.2;Working with the Model Object;100
9.3;Working with Layouts;102
9.3.1;Creating the Layout;103
9.3.2;Applying a Layout;105
9.3.3;Using a View Start File;105
9.3.4;Demonstrating Shared Layouts;106
9.4;Using Razor Expressions;110
9.4.1;Inserting Data Values;111
9.4.2;Setting Attribute Values;113
9.4.3;Using Conditional Statements;115
9.4.4;Enumerating Arrays and Collections;118
9.4.5;Dealing with Namespaces;120
9.5;Summary;121
10;Chapter 6: Essential Tools for MVC;122
10.1;Preparing the Example Project;123
10.1.1;Creating the Model Classes;123
10.1.2;Adding the Controller;124
10.1.3;Adding the View;125
10.2;Using Ninject;126
10.2.1;Understanding the Problem;126
10.2.1.1;Applying an Interface;126
10.2.2;Adding Ninject to the Visual Studio Project;128
10.2.3;Getting Started with Ninject;128
10.2.4;Setting up MVC Dependency Injection;130
10.2.4.1;Creating the Dependency Resolver;130
10.2.4.2;Register the Dependency Resolver;131
10.2.4.3;Refactoring the Home Controller;131
10.2.5;Creating Chains of Dependency;133
10.2.6;Specifying Property and Constructor Parameter Values;134
10.2.7;Using Conditional Binding;136
10.2.8;Setting the Object Scope;137
10.3;Unit Testing with Visual Studio;140
10.3.1;Creating the Unit Test Project;140
10.3.2;Creating the Unit Tests;142
10.3.3;Running the Unit Tests (and Failing);145
10.3.4;Implementing the Feature;146
10.3.5;Testing and Fixing the Code;147
10.4;Using Moq;148
10.4.1;Understanding the Problem;149
10.4.2;Adding Moq to the Visual Studio Project;150
10.4.3;Adding a Mock Object to a Unit Test;150
10.4.3.1;Creating a Mock Object;151
10.4.3.2;Selecting a Method;152
10.4.3.3;Defining the Result;153
10.4.3.4;Using the Mock Object;153
10.4.4;Creating a More Complex Mock Object;153
10.4.4.1;Mocking For Specific Values (and Throwing an Exception);155
10.4.4.2;Mocking For a Range of Values;156
10.5;Summary;156
11;Chapter 7: SportsStore: A Real Application;157
11.1;Getting Started;158
11.1.1;Creating the Visual Studio Solution and Projects;158
11.1.2;Installing the Tool Packages;160
11.1.3;Adding References Between Projects;160
11.1.4;Setting Up the DI Container;161
11.1.5;Running the Application;162
11.2;Starting the Domain Model;162
11.2.1;Creating an Abstract Repository;163
11.2.2;Making a Mock Repository;164
11.3;Displaying a List of Products;165
11.3.1;Adding a Controller;165
11.3.2;Adding the Layout, View Start File and View;167
11.3.2.1;Rendering the View Data;168
11.3.3;Setting the Default Route;168
11.3.4;Running the Application;169
11.4;Preparing a Database;170
11.4.1;Creating the Database;171
11.4.2;Defining the Database Schema;173
11.4.3;Adding Data to the Database;175
11.4.4;Creating the Entity Framework Context;176
11.4.5;Creating the Product Repository;178
11.5;Adding Pagination;180
11.5.1;Displaying Page Links;182
11.5.1.1;Adding the View Model;182
11.5.1.2;Adding the HTML Helper Method;183
11.5.1.3;Adding the View Model Data;185
11.5.1.4;Displaying the Page Links;189
11.5.2;Improving the URLs;191
11.6;Styling the Content;192
11.6.1;Installing the Bootstrap Package;192
11.6.2;Applying Bootstrap Styles to the Layout;193
11.6.3;Creating a Partial View;195
11.7;Summary;198
12;Chapter 8: SportsStore: Navigation;199
12.1;Adding Navigation Controls;199
12.1.1;Filtering the Product List;199
12.1.2;Refining the URL Scheme;204
12.1.3;Building a Category Navigation Menu;206
12.1.3.1;Creating the Navigation Controller;207
12.1.3.2;Generating Category Lists;208
12.1.3.3;Creating the View;210
12.1.3.4;Highlighting the Current Category;211
12.1.4;Correcting the Page Count;214
12.2;Building the Shopping Cart;216
12.2.1;Defining the Cart Entity;217
12.2.2;Adding the Add to Cart Buttons;221
12.2.3;Implementing the Cart Controller;222
12.2.4;Displaying the Contents of the Cart;224
12.3;Summary;227
13;Chapter 9: SportsStore: Completing the Cart;228
13.1;Using Model Binding;228
13.1.1;Creating a Custom Model Binder;228
13.2;Completing the Cart;233
13.2.1;Removing Items from the Cart;233
13.2.2;Adding the Cart Summary;235
13.3;Submitting Orders;237
13.3.1;Extending the Domain Model;237
13.3.2;Adding the Checkout Process;238
13.3.3;Implementing the Order Processor;245
13.3.3.1;Defining the Interface;245
13.3.3.2;Implementing the Interface;246
13.3.4;Registering the Implementation;248
13.3.5;Completing the Cart Controller;249
13.3.6;Displaying Validation Errors;253
13.3.7;Displaying a Summary Page;255
13.4;Summary;255
14;Chapter 10: SportsStore: Mobile;256
14.1;Putting Mobile Web Development in Context;256
14.1.1;Doing Nothing (Or As Little As Possible);256
14.2;Using Responsive Design;258
14.2.1;Creating a Responsive Header;259
14.2.2;Creating a Responsive Product List;262
14.2.2.1;Helping the Controller Select a View;265
14.2.2.2;Removing View Duplication;267
14.3;Creating Mobile Specific Content;270
14.3.1;Creating a Mobile Layout;271
14.3.2;Creating the Mobile Views;272
14.4;Summary;275
15;Chapter 11: SportsStore: Administration;276
15.1;Adding Catalog Management;276
15.1.1;Creating a CRUD Controller;276
15.1.2;Creating a New Layout;278
15.1.3;Implementing the List View;279
15.1.4;Editing Products;283
15.1.4.1;Creating the Edit Action Method;283
15.1.4.2;Creating the Edit View;285
15.1.4.3;Updating the Product Repository;289
15.1.4.4;Handling Edit POST Requests;291
15.1.4.5;Displaying a Confirmation Message;293
15.1.4.6;Adding Model Validation;295
15.1.4.7;Enabling Client-Side Validation;297
15.1.5;Creating New Products;298
15.1.6;Deleting Products;301
15.2;Summary;304
16;Chapter 12: SportsStore: Security & Finishing Touches;305
16.1;Securing the Administration Controller;305
16.1.1;Creating a Basic Security Policy;305
16.1.2;Applying Authorization with Filters;307
16.1.3;Creating the Authentication Provider;309
16.1.4;Creating the Account Controller;311
16.1.5;Creating the View;312
16.2;Image Uploads;315
16.2.1;Extending the Database;316
16.2.2;Enhancing the Domain Model;316
16.2.3;Creating the Upload User Interface Elements;317
16.2.4;Saving Images to the Database;319
16.2.5;Implementing the GetImage Action Method;321
16.2.6;Displaying Product Images;325
16.3;Summary;327
17;Chapter 13: Deployment;328
17.1;Preparing Windows Azure;329
17.1.1;Creating the Web Site and Database;329
17.1.2;Preparing the Database for Remote Administration;332
17.1.3;Creating the Schema;333
17.1.3.1;Getting the Schema Command;334
17.1.3.2;Adding the Table Data;334
17.2;Deploying the Application;335
17.3;Summary;342
18;Chapter 14: Overview of MVC Projects;343
18.1;Working with Visual Studio MVC Projects;343
18.1.1;Creating the Project;343
18.1.2;Understanding MVC Conventions;347
18.1.2.1;Following Conventions for Controller Classes;348
18.1.2.2;Following Conventions for Views;348
18.1.2.3;Following Conventions for Layouts;349
18.2;Debugging MVC Applications;349
18.2.1;Preparing the Example Project;349
18.2.1.1;Creating the Controller;351
18.2.1.2;Creating the View;352
18.2.2;Launching the Visual Studio Debugger;353
18.2.3;Causing the Visual Studio Debugger to Break;355
18.2.3.1;Using Breakpoints;355
18.2.3.2;Viewing Data Values in the Code Editor;356
18.2.3.3;Viewing Application State in the Debugger Windows;358
18.2.3.4;Breaking on Exceptions;359
18.2.4;Using Edit and Continue;361
18.2.4.1;Enabling Edit and Continue;361
18.2.4.2;Modifying the Project;362
18.2.4.3;Editing and Continuing;363
18.3;Using Browser Link;364
18.4;Summary;366
19;Chapter 15: URL Routing;367
19.1;Preparing the Example Project;368
19.1.1;Creating the Example Controllers;369
19.1.2;Creating the View;370
19.1.3;Setting the Start URL and Testing the Application;371
19.2;Introducing URL Patterns;371
19.3;Creating and Registering a Simple Route;373
19.3.1;Using the Simple Route;375
19.4;Defining Default Values;379
19.5;Using Static URL Segments;381
19.6;Defining Custom Segment Variables;386
19.6.1;Using Custom Variables as Action Method Parameters;389
19.6.2;Defining Optional URL Segments;389
19.6.2.1;Using Optional URL Segments to Enforce Separation of Concerns;391
19.6.3;Defining Variable-Length Routes;392
19.6.4;Prioritizing Controllers by Namespaces;394
19.7;Constraining Routes;397
19.7.1;Constraining a Route Using a Regular Expression;397
19.7.2;Constraining a Route to a Set of Specific Values;398
19.7.3;Constraining a Route Using HTTP Methods;399
19.7.4;Using Type and Value Constraints;400
19.7.5;Defining a Custom Constraint;403
19.8;Using Attribute Routing;405
19.8.1;Enabling and Applying Attribute Routing;406
19.8.2;Creating Routes with Segment Variables;408
19.8.3;Applying Route Constraints;409
19.8.3.1;Combining Constraints;410
19.8.4;Using a Route Prefix;411
19.9;Summary;412
20;Chapter 16: Advanced Routing Features;413
20.1;Preparing the Example Project;414
20.1.1;Simplifying the Routes;414
20.1.2;Adding the Optimization Package;414
20.1.3;Updating the Unit Test Project;414
20.2;Generating Outgoing URLs in Views;415
20.2.1;Using the Routing System to Generate an Outgoing URL;415
20.2.2;Targeting Other Controllers;418
20.2.3;Passing Extra Values;420
20.2.4;Specifying HTML Attributes;422
20.2.5;Generating Fully Qualified URLs in Links;423
20.2.6;Generating URLs (and Not Links);424
20.2.7;Generating Outgoing URLs in Action Methods;425
20.2.8;Generating a URL from a Specific Route;426
20.3;Customizing the Routing System;428
20.3.1;Creating a Custom RouteBase Implementation;428
20.3.1.1;Routing Incoming URLs;429
20.3.1.2;Generating Outgoing URLs;431
20.3.2;Creating a Custom Route Handler;432
20.4;Working with Areas;434
20.4.1;Creating an Area;434
20.4.2;Populating an Area;436
20.4.3;Resolving the Ambiguous Controller Issue;438
20.4.4;Creating Areas with Attributes;440
20.4.5;Generating Links to Actions in Areas;441
20.5;Routing Requests for Disk Files;441
20.5.1;Configuring the Application Server;443
20.5.2;Defining Routes for Disk Files;444
20.6;Bypassing the Routing System;446
20.7;URL Schema Best Practices;447
20.7.1;Make Your URLs Clean and Human-Friendly;447
20.7.2;GET and POST: Pick the Right One;448
20.8;Summary;448
21;Chapter 17: Controllers and Actions;449
21.1;Preparing the Example Project;450
21.1.1;Setting the Start URL;450
21.2;Introducing the Controller;450
21.2.1;Creating a Controller with IController;450
21.2.2;Creating a Controller by Deriving from the Controller Class;453
21.3;Receiving Request Data;454
21.3.1;Getting Data from Context Objects;455
21.3.2;Using Action Method Parameters;456
21.3.2.1;Understanding How Parameters Objects Are Instantiated;457
21.3.2.2;Understanding Optional and Compulsory Parameters;457
21.3.2.3;Specifying Default Parameter Values;457
21.4;Producing Output;458
21.4.1;Understanding Action Results;460
21.4.2;Returning HTML by Rendering a View;463
21.4.3;Passing Data from an Action Method to a View;467
21.4.3.1;Providing a View Model Object;467
21.4.3.2;Passing Data with the View Bag;470
21.4.4;Performing Redirections;472
21.4.4.1;Redirecting to a Literal URL;472
21.4.4.2;Redirecting to a Routing System URL;474
21.4.4.3;Redirecting to an Action Method;475
21.4.5;Returning Errors and HTTP Codes;477
21.4.5.1;Sending a Specific HTTP Result Code;477
21.4.5.2;Sending a 404 Result;478
21.4.5.3;Sending a 401 Result;478
21.5;Summary;479
22;Chapter 18: Filters;480
22.1;Preparing the Example Project;480
22.1.1;Setting the Start URL and Testing the Application;483
22.2;Using Filters;483
22.2.1;Introducing the Filter Types;484
22.2.2;Applying Filters to Controllers and Action Methods;485
22.3;Using Authorization Filters;486
22.3.1;Applying the Custom Authorization Filter;488
22.3.2;Using the Built-in Authorization Filter;489
22.4;Using Authentication Filters;490
22.4.1;Understanding the IAuthenticationFilter Interface;490
22.4.2;Implementing the Authentication Check;492
22.4.3;Combining Authentication and Authorization Filters;494
22.4.4;Handling the Final Challenge Request;495
22.5;Using Exception Filters;496
22.5.1;Creating an Exception Filter;496
22.5.2;Applying the Exception Filter;498
22.5.3;Using a View to Respond to an Exception;500
22.5.3.1;Avoiding the Wrong Exception Trap;502
22.5.4;Using the Built-in Exception Filter;503
22.5.4.1;Preparing to Use the Built-in Exception Filter;504
22.5.4.2;Applying the Built-in Exception Filter;505
22.6;Using Action Filters;506
22.6.1;Implementing the OnActionExecuting Method;506
22.6.2;Implementing the OnActionExecuted Method;509
22.7;Using Result Filters;510
22.7.1;Using the Built-in Action and Result Filter Class;512
22.8;Using Other Filter Features;514
22.8.1;Filtering Without Attributes;514
22.8.2;Using Global Filters;516
22.8.3;Ordering Filter Execution;518
22.8.4;Overriding Filters;521
22.9;Summary;524
23;Chapter 19: Controller Extensibility;525
23.1;Preparing the Example Project;526
23.1.1;Setting the Start URL;528
23.2;Creating a Custom Controller Factory;528
23.2.1;Dealing with the Fallback Controller;530
23.2.2;Instantiating Controller Classes;531
23.2.3;Implementing the Other Interface Methods;531
23.2.4;Registering a Custom Controller Factory;532
23.3;Working with the Built-in Controller Factory;532
23.3.1;Prioritizing Namespaces;533
23.3.2;Customizing DefaultControllerFactory Controller Instantiation;534
23.3.2.1;Using the Dependency Resolver;534
23.3.2.2;Using a Controller Activator;534
23.3.2.3;Overriding DefaultControllerFactory Methods;536
23.4;Creating a Custom Action Invoker;537
23.5;Using the Built-in Action Invoker;538
23.5.1;Using a Custom Action Name;539
23.5.2;Using Action Method Selection;541
23.5.2.1;Creating a Custom Action Method Selector;543
23.5.2.2;Handling Unknown Actions;546
23.6;Improving Performance with Specialized Controllers;547
23.6.1;Using Sessionless Controllers;547
23.6.1.1;Managing Session State in a Custom IControllerFactory;547
23.6.1.2;Managing Session State Using DefaultControllerFactory;548
23.6.2;Using Asynchronous Controllers;549
23.6.2.1;Creating the Example;550
23.6.2.2;Creating an Asynchronous Controller;552
23.6.2.3;Consuming Asynchronous Methods in a Controller;553
23.7;Summary;554
24;Chapter 20: Views;555
24.1;Creating a Custom View Engine;555
24.1.1;Preparing the Example Project;558
24.1.2;Creating a Custom IView;559
24.1.3;Creating an IViewEngine Implementation;560
24.1.4;Registering a Custom View Engine;561
24.1.5;Testing the View Engine;562
24.2;Working with the Razor Engine;564
24.2.1;Preparing the Example Project;564
24.2.2;Understanding Razor View Rendering;565
24.2.3;Configuring the View Search Locations;566
24.3;Adding Dynamic Content to a Razor View;569
24.3.1;Using Layout Sections;570
24.3.1.1;Testing For Sections;573
24.3.1.2;Rendering Optional Sections;574
24.3.2;Using Partial Views;575
24.3.2.1;Creating a Partial View;576
24.3.2.2;Using Strongly Typed Partial Views;578
24.3.3;Using Child Actions;579
24.3.3.1;Creating a Child Action;579
24.3.3.2;Rendering a Child Action;580
24.4;Summary;581
25;Chapter 21: Helper Methods;582
25.1;Preparing the Example Project;582
25.1.1;Setting the Start URL;583
25.1.2;Testing the Example Application;584
25.2;Creating Custom Helper Methods;584
25.2.1;Creating an Inline Helper Method;584
25.2.2;Creating an External Helper Method;586
25.2.2.1;Using a Custom External Helper Method;588
25.2.3;Managing String Encoding in a Helper Method;590
25.2.3.1;Demonstrating the Problem;590
25.2.3.2;Encoding Helper Method Content;592
25.3;Using the Built-In Form Helper Methods;594
25.3.1;Creating Form Elements;594
25.3.1.1;Creating Form Elements;598
25.3.2;Specifying the Route Used by a Form;601
25.3.3;Using Input Helpers;603
25.3.3.1;Generating the Input Element from a Model Property;605
25.3.3.2;Using Strongly Typed Input Helpers;606
25.3.4;Creating Select Elements;608
25.4;Summary;610
26;Chapter 22: Templated Helper Methods;611
26.1;Preparing the Example Project;611
26.2;Using Templated Helper Methods;614
26.2.1;Generating Label and Display Elements;618
26.2.2;Using Whole-Model Templated Helpers;620
26.3;Using Model Metadata;623
26.3.1;Using Metadata to Control Editing and Visibility;624
26.3.2;Using Metadata for Labels;626
26.3.3;Using Metadata for Data Values;628
26.3.4;Using Metadata to Select a Display Template;629
26.3.5;Applying Metadata to a Buddy Class;631
26.3.6;Working with Complex Type Properties;633
26.4;Customizing the Templated View Helper System;634
26.4.1;Creating a Custom Editor Template;634
26.4.2;Creating a Generic Template;636
26.4.3;Replacing the Built-in Templates;637
26.5;Summary;638
27;Chapter 23: URL and Ajax Helper Methods;639
27.1;Preparing the Example Project;640
27.1.1;Defining Additional CSS Styles;640
27.1.2;Installing the NuGet Packages;641
27.2;Creating Basic Links and URLs;641
27.3;Using MVC Unobtrusive Ajax;644
27.3.1;Creating the Synchronous Form View;644
27.3.2;Preparing the Project for Unobtrusive Ajax;645
27.4;Creating an Unobtrusive Ajax Form;647
27.4.1;Preparing the Controller;647
27.4.2;Creating the Ajax Form;649
27.4.3;Understanding How Unobtrusive Ajax Works;651
27.5;Setting Ajax Options;651
27.5.1;Ensuring Graceful Degradation;652
27.5.2;Providing the User with Feedback While Making an Ajax Request;653
27.5.3;Prompting the User Before Making a Request;655
27.6;Creating Ajax Links;656
27.6.1;Ensuring Graceful Degradation for Links;658
27.7;Working with Ajax Callbacks;658
27.8;Working with JSON;661
27.8.1;Adding JSON Support to the Controller;661
27.8.2;Processing JSON in the Browser;662
27.8.3;Preparing Data for Encoding;665
27.8.4;Detecting Ajax Requests in the Action Method;666
27.9;Summary;669
28;Chapter 24: Model Binding;670
28.1;Preparing the Example Project;670
28.2;Understanding Model Binding;673
28.3;Using the Default Model Binder;675
28.3.1;Binding to Simple Types;675
28.3.2;Binding to Complex Types;678
28.3.2.1;Creating Easily-Bound HTML;680
28.3.2.2;Specifying Custom Prefixes;682
28.3.2.3;Selectively Binding Properties;684
28.3.3;Binding to Arrays and Collections;685
28.3.3.1;Binding to Arrays;685
28.3.3.2;Binding to Collections;687
28.3.3.3;Binding to Collections of Custom Model Types;688
28.4;Manually Invoking Model Binding;691
28.4.1;Dealing with Binding Errors;693
28.5;Customizing the Model Binding System;694
28.5.1;Creating a Custom Value Provider;694
28.5.2;Creating a Custom Model Binder;697
28.5.3;Registering the Custom Model Binder;699
28.5.3.1;Registering a Model Binder with an Attribute;700
28.6;Summary;700
29;Chapter 25: Model Validation;701
29.1;Preparing the Example Project;702
29.1.1;Creating the Layout;703
29.1.2;Creating the Views;703
29.2;Explicitly Validating a Model;705
29.2.1;Displaying Validation Errors to the User;706
29.3;Displaying Validation Messages;708
29.3.1;Displaying Property-Level Validation Messages;712
29.4;Using Alternative Validation Techniques;713
29.4.1;Performing Validation in the Model Binder;713
29.4.2;Specifying Validation Rules Using Metadata;715
29.4.2.1;Creating a Custom Property Validation Attribute;716
29.4.2.2;Deriving from the Built-In Validation Attributes;718
29.4.2.3;Creating a Model Validation Attribute;719
29.4.3;Defining Self-Validating Models;721
29.5;Performing Client-Side Validation;723
29.5.1;Enabling Client-Side Validation;723
29.5.1.1;Adding the NuGet Packages;724
29.5.2;Using Client-Side Validation;725
29.5.3;Understanding How Client-Side Validation Works;726
29.6;Performing Remote Validation;727
29.7;Summary;731
30;Chapter 26: Bundles;732
30.1;Preparing the Example Application;732
30.1.1;Adding the NuGet Packages;732
30.1.2;Creating the Model and Controller;733
30.1.3;Creating the Layout and View;734
30.2;Profiling Script and Style Sheet Loading;737
30.3;Using Script and Style Bundles;738
30.3.1;Adding the NuGet Package;739
30.3.2;Defining the Bundles;739
30.3.3;Applying Bundles;741
30.3.4;Optimizing the JavaScript and CSS Files;743
30.4;Summary;745
31;Chapter 27: Web API and Single-page Applications;746
31.1;Understanding Single-page Applications;746
31.2;Preparing the Example Application;747
31.2.1;Creating the Model;747
31.2.2;Adding the NuGet Packages;749
31.2.3;Adding the Controller;750
31.2.4;Adding the Layout and Views;751
31.2.5;Setting the Start Location and Testing the Example Application;753
31.3;Using Web API;754
31.3.1;Creating the Web API Controller;754
31.3.2;Testing the API Controller;755
31.4;Understanding How the API Controller Works;756
31.4.1;Understanding API Controller Action Selection;758
31.4.2;Mapping HTTP Methods to Action Methods;758
31.5;Using Knockout for Single-page Applications;759
31.5.1;Adding the JavaScript Libraries to the Layout;760
31.5.2;Implementing the Summary;761
31.5.2.1;Defining the Ajax Functions;762
31.5.2.2;Defining the Model;763
31.5.2.3;Defining the Bindings;764
31.5.2.4;Processing the Bindings;765
31.5.2.5;Testing the Summary Bindings;765
31.5.2.6;Improving the Delete Feature;767
31.5.3;Implementing the Create Feature;768
31.5.3.1;Extending the Model;770
31.5.3.2;Implement the Input Elements;770
31.5.3.3;Creating the Event Handler;770
31.5.3.4;Testing the Create Feature;771
31.6;Completing the Application;771
31.6.1;Simplify the Home Controller;772
31.6.2;Manage Content Visibility;772
31.7;Summary;775
32;Index;776


Adam Freeman is an experienced IT professional who has held senior positions in a range of companies, most recently serving as chief technology officer and chief operating officer of a global bank. Now retired, he spends his time writing and long-distance running.


Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.