问题
Just out of curiosity I like to know the preferred ordering, based on technical level and new api of the examples.
For the most part, all the base infrastructure concerns all smell the same i.e. setup of the host ect.. but when it comes to the Service Models, Service Interface, and Endpoint setup, which are the most current and preferred?
Thank you, Stephen
回答1:
ServiceStack example projects aren't supposed to be consumed in any particular order, they're just different examples illustrating what you can do with ServiceStack.
Setting up ServiceStack
If you want to know how to create and setup a ServiceStack service the easiest way is to Create your project with ServiceStackVS VS.NET extension, there's also the Getting Started section on the wiki and the Hello World example project can give you a good idea of what ServiceStack enables. This gist is another a good example of what you get with just 1 C# .cs class in ServiceStack.
Designing and structuring a REST API
If you're comfortable with setting up and configuring ServiceStack I've provided a detailed overview of how I'd go about designing a REST API inc. the physical layout and code structure in this earlier answer.
Example Projects, Use-cases and Live Demos
Otherwise the example projects and live demos are good reference examples showing how ServiceStack can be used to power individual use-cases. So you would basically just explore the ones that are similar to your use-case. I'll provide a description of each
Email Contacts
The EmailContacts repository is a new guidance available that walks through the recommended setup and physical layout structure of typical medium-sized ServiceStack projects, including complete documentation of how to create the solution from scratch, whilst explaining all the ServiceStack features it makes use of along the way. It also shows how to make use of ServiceStack's new Rabbit MQ Support.
HTTP Benchmarks
The HttpBenchmarks repository allows you to upload Apache HTTP Benchmarks to visualize and analyze their results. It's an example of a "Social website" supporting Twitter, Facebook, Google and LinkedIn OAuth providers, Registration of new Users, Personalized home page, Creation of User-defined top-level routes (e.g. twitter.com/userslug). It also walks through its integration with Glimpe, DotNetOpenAuth, FineUploader, DotNetZip and Highcharts.js. Hosting and deploying to AWS, Configuration of SSL certificates and enable forced redirects to https.
Chat
Chat takes you through how to build a rich Single Page Chat WebApp using Server push notifications enabled by ServiceStack's integrated support for Server Sent Events. It walks through the Server Event client bindings in /js/ss-utils.js to provide a number of flexible options for invoking pre-defined functionality in existing web apps, which it uses to show how to remote-control other users Chat Window with minimal effort.
Razor Rockstars
A server-side (and client-side) generated HTML Website generated using just ServiceStack's built-in Razor and Markdown Razor HTML support. It shows how existing ServiceStack services can be enhanced with Razor views enabling the same Service to power both a web site and rich native Desktop and Mobile clients.
Northwind.Data
Another rich server-side website further illustrating the ability of being able to build both a feature-rich website as well as REST and typed message-based APIs re-using the same ServiceStack services, serving both browsers and native Desktop and Mobile clients. Other than providing a rich browsing experience it shows how to provide a rich OData-like experience using LLBLGen.
Matt Cowan provides a good tutorial of how he built Nortwind.Data on his blog and provides a Great Followup showing how to add Theming to ServiceStack Razor Views.
Real-time Order fulfillments
StarBucks-like real-time ordering fulfillment Single Page App built with ServiceStack, MVC, AngularJS, SignalR, Sqlite and Redis. Supports different user roles where any User can create an order which gets placed in a Queue and can be fulfilled by an authenticated 'Fulfiller'.
Social Bootstrap API
A Backbone.js-based Single Page App built with ServiceStack + ASP.NET MVC showing how to enable all different Authentication Providers in a single App, be able to connect to Social APIs and the different ways of how to integrate ServiceStack + MVC.
ServiceStack.UseCases
We've changed the way we're creating demo applications, instead of complete stand-alone example apps we're developing single-purpose applications showcasing a single use-case.
- Custom Authentication and Integration with ASP.NET
- Custom Authentication and Integration with ASP.NET MVC
- Different ways to say Hello, with built-in Content-Types, text, html and generating a dynamic image
- Image Resizer - A Single Page App in 1 C# and 1 HTML page allowing uploads of any image via Form Upload or Url, resizing and cropping each image in the different pre-set resolution sizes for all iOS devices
- Reusability - showcasing how you can re-use the same services inside MQ hosts to provide instant response times and transparent parallel execution
- Poco Power - Showing how you can re-use the same POCOs in all ServiceStack client libraries. From maintaing complex types in Web.config to creating DB tables with OrmLite to calling 3rd Party twitter and GitHub REST APIs and storing and retrieving them in RDBMS and Redis
- Use node.js as a front-end proxy to a backend ServiceStack instance on Windows and OSX/Linux
- Swagger Hello World - Simple service with Swagger integration and features enabled
- WebApi Products Example - Showcase the differences rewriting WebApi products into a ServiceStack service
ServiceStack.Examples
Where all ServiceStack example projects were kept containing simple, stand-alone, single-purpose focused single page apps.
- Hello World, Setting up ServiceStack and creating a Hello World Service
- Backbone TODOs - The simplest REST/CRUD app built with ServiceStack
- ServiceStack Docs is an example of a Content Heavy Ajax site using built just using Markdown Razor
- A mini StackOverflow Single Page App built using just ServiceStack + Redis
- GitHub REST Files - Showing how to build an WebDAV-like online file system manager
- REST Intro - showing how to structure and physically layout a simple REST app
- Movie REST - visualizing the different REST operations as they happen
- Northwind database viewer, showing how to easily expose read and cached view services of an internal dataset with ServiceStack + OrmLite
Starter Templates
Different working starting templates for popular configurations of ServiceStack:
- At custom path, like /api
- At / root path
- A stand-alone HttpListener Console AppHost
- A Windows Service AppHost
来源:https://stackoverflow.com/questions/15862634/in-what-order-are-the-servicestack-examples-supposed-to-be-grokked