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

Utilizing stored procedures using OrmLite


When using object-relation mapping (ORM) frameworks, the queries are constructed using the language of the host application. However, some situations might require the use of a database-specific query using a stored procedure. In this recipe, we will go through an example of this using OrmLite to access your custom-stored procedures and mapping the return value to strongly typed objects.

Getting ready

In this example, we will use Microsoft SQL Server 2012 Express and the AdventureWorks product sample database to illustrate how to access stored procedures. 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 to help get your project up and running. You will also require SQL Server installed with the AdventureWorks database attached to follow along with the example. At the time...