0

there are extremely few docs about ServiceStack around. Let alone database first approach. So now I have OrmLite.Poco.cs with all the models mapped from SQL Server. What is the next step? Add routes to the models on OrmLite.Poco.cs or copy out each class into individual .cs file then add routes to it? Thanks.

Gray
  • 115,027
  • 24
  • 293
  • 354
Isley
  • 197
  • 15

1 Answers1

3

Great you now have your Table POCO's which you can start querying with, e.g:

var results = Db.Select<Poco>();

Custom Routes only go on Request DTO's you should not re-use your OrmLite models to also define the contract for your Services.

For an example, checkout this Simple OrmLite Database sample showing how to use the Customer Table POCO in OrmLite to create a Simple Customer REST Service.

Community
  • 1
  • 1
mythz
  • 141,670
  • 29
  • 246
  • 390
  • I printed out the `Simple Customer REST Service` answer @mythz referred to above and use it religiously. Conceivably the only improvement would be to include `[DTO class] : IReturn<[resource]>` to most DTOs, to have a more strongly typed response to the various actions. – jklemmack Jul 28 '15 at 20:57