Book Image

ServiceStack 4 Cookbook

Book Image

ServiceStack 4 Cookbook

Overview of this book

Table of Contents (18 chapters)
ServiceStack 4 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Mapping custom queries to POCOs


One of the big advantages of relational databases is the normalization of data or the ability to avoid data duplication and have the confidence that this is enforced by the database itself. However, as data is not duplicated across tables, we need to perform joins on various tables to group all this non-duplicated data together for our queries. As of version 4.0.22, ServiceStack OrmLite provides API methods capable of creating complex custom queries, including join statements that can be returned mapped to a Plain Old CLR Object of your choosing.

Getting ready

In this recipe, we will create a simple Hello World service that stores a formatted response in a SQLite database on which we can perform our OrmLite queries. To get started, you'll need a new project created either using a template from the ServiceStackVS extension or by following the section Creating a ServiceStack solution with Visual Studio and NuGet in Appendix A, Getting Started.

How to do it…

  1. Install...