CRUD and other common operations
When working with a database, CRUD often refers to Create, Read, Update, and Delete. With a relational database, this often maps to the Insert, Select, Update, and Delete operations. You can also loosely associate the concepts with the HTTP verbs GET, DELETE, POST, and PUT, even though it's not a perfect one-to-one mapping.
Getting ready
In this recipe, we will create a simple Hello World
service that stores a formatted response of a simple greeting in a SQLite database that we can perform our CRUD operations on. To get started, you'll need a new project either created 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…
Create a model for the
UserGreeting
table, as follows. This will be the class we persist using OrmLite:public class UserGreeting { [PrimaryKey] [AutoIncrement] public int Id { get; set; } public...