更新时间:2021-08-06 19:33:20
coverpage
ServiceStack 4 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files eBooks discount offers and more
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Conventions
Reader feedback
Customer support
Chapter 1. Configuration and Routing
Introduction
Up and running with ServiceStack
Routing using data transfer object attributes
Isolating web service routes from a web application
Common ServiceStack plugins
Writing a custom audit plugin
Adding Routes via the API
Structuring your project to avoid dependency issues
Managing dependencies with Funq and Inversion of Control (IoC)
Sharing and accessing configuration and common functionality using Funq IoC
Chapter 2. Services and Data Transfer Objects
Creating a basic create/read/update/delete service
Splitting HTTP request methods
Hosting services from different assemblies
Utilizing the original HTTP request
Overriding serialization of request object types
Creating a simple admin service
Intercepting requests and responses using attributes
Making a basic proxy for existing web services
Wrapping multiple existing services and exposing them through ServiceStack
Chapter 3. Testing and Logging
Unit testing ServiceStack applications
Integration testing with the ServiceStack C# client
Functional contract testing ServiceStack services
Accessing the request-and-response object with the JsonServiceClient
Continuous Integration with TeamCity and self-hosted services
Logging with a choice of frameworks
Writing a logger to monitor exceptions via e-mail
Chapter 4. Object Relational Mapping (OrmLite)
Modeling your database with types and attributes
Using and accessing OrmLite
Using OrmLite filters to create audit functionality
CRUD and other common operations
Utilizing stored procedures using OrmLite
Mapping custom queries to POCOs
Starting with an existing database with OrmLite and T4 templates
Working with Entity Framework and ServiceStack
Chapter 5. HTML and Form Data
Getting started with ServiceStack and Razor templates
Using Markdown for website content
Handling file uploads and streaming data from services
Overriding Razor views or templates using attributes
Creating and displaying a login and registration page based on authentication
Submitting a form to a service and handling server-side validation on an HTML client
Chapter 6. Filters and Validators
Creating static validation rules using fluent syntax
Returning meaningful HTTP error messages
Adding custom headers via the response filter
Restricting file uploads by type using filters
Creating a user-configurable HTTP callback service using a response filter
Applying a rate limit to a web service endpoint using request filter
Restrict user actions by session details using a validator
Common HTTP status codes
Chapter 7. Security and Authentication
Getting started with authentication sessions registration and user repositories
Getting started with Twitter authentication
Getting started with Google authentication
Getting started with Facebook authentication
Using multiple authentication providers and persisting a user's preferred profile image
Handling password resets for credential-based authentication
Accessing Windows identity information from ServiceStack for an intranet application
Validating password complexity with a custom registration validator
Migrating users from another system by overriding ServiceStack's credential-based authentication
Writing your own OpenID authentication provider
Chapter 8. Working with Redis
Getting started with ServiceStack.Redis
Using Redis as a cache with the ServiceStack client
Using ServiceStack.Redis for publish/subscribe
Using the ServiceStack.Redis client to access a Redis list
Using Redis hash data structures in ServiceStack
Using Redis Set data structures in ServiceStack
Using typed data structures with ServiceStack and Redis
Scripting Redis with Lua
Chapter 9. Integrating with Other Technologies
Integrating with ServiceStack using the C# client and Native Types
Using ServiceStack with WebForms applications