ServiceStack 示例应该以啥顺序被理解?

Posted

技术标签:

【中文标题】ServiceStack 示例应该以啥顺序被理解?【英文标题】:In what order are the ServiceStack examples supposed to be grokked?ServiceStack 示例应该以什么顺序被理解? 【发布时间】:2013-03-29 13:30:41 【问题描述】:

出于好奇,我想知道基于技术水平和示例的新 API 的首选顺序。

在大多数情况下,所有基本基础架构问题都闻起来相同,即主机等设置。但是当涉及到服务模型、服务接口和端点设置时,哪些是最新和首选的?

谢谢你, 斯蒂芬

【问题讨论】:

【参考方案1】:

ServiceStack 示例项目不应该以任何特定顺序使用,它们只是说明您可以使用 ServiceStack 做什么的不同示例。

设置 ServiceStack

如果您想知道如何创建和设置 ServiceStack 服务,最简单的方法是使用 Create your project with ServiceStackVS VS.NET 扩展,还有 Getting Started section on the wiki 和 Hello World example project 可以让您很好地了解 ServiceStack 支持的功能.这个要点是您使用just 1 C# .cs class in ServiceStack 获得的另一个很好的例子。

设计和构建 REST API

如果您对设置和配置 ServiceStack 感到满意,我已经详细介绍了我将如何处理 designing a REST API inc. the physical layout and code structure in this earlier answer。

示例项目、用例和Live Demos

否则,示例项目和live demos 是很好的参考示例,展示了如何使用 ServiceStack 来支持单个用例。因此,您基本上只会探索与您的用例相似的那些。我将提供每个的描述

Email Contacts

EmailContacts repository 是一个新指南,介绍了典型中型 ServiceStack 项目的推荐设置和物理布局结构,包括有关如何从头开始创建解决方案的完整文档,同时解释了它提供的所有 ServiceStack 功能沿途使用。它还展示了如何使用ServiceStack's new Rabbit MQ Support。

HTTP Benchmarks

HttpBenchmarks repository 允许您上传 Apache HTTP 基准以可视化和分析其结果。这是一个“社交网站”示例,支持 Twitter、Facebook、Google 和 LinkedIn OAuth 提供商、新用户注册、个性化主页、创建用户定义的***路由(例如 twitter.com/userslug)。它还介绍了与 Glimpe、DotNetOpenAuth、FineUploader、DotNetZip 和 Highcharts.js 的集成。托管和部署到 AWS,配置 SSL 证书并启用强制重定向到 https。

Chat

Chat 将带您了解如何使用 ServiceStack 对 Server Sent Events 的集成支持启用的服务器推送通知构建丰富的单页聊天 WebApp。它遍历 /js/ss-utils.js 中的服务器事件客户端绑定,以提供许多灵活的选项来调用现有 Web 应用程序中的预定义功能,用于展示如何以最小的努力远程控制其他用户聊天窗口。

Razor Rockstars

仅使用 ServiceStack 的内置 Razor 和 Markdown Razor html 支持生成的服务器端(和客户端)生成的 HTML 网站。它展示了如何使用 Razor 视图增强现有的 ServiceStack 服务,从而使同一服务能够同时支持网站以及丰富的原生桌面和移动客户端。

Northwind.Data

另一个丰富的服务器端网站进一步说明了能够构建功能丰富的网站以及 REST 和基于类型消息的 API 重用相同的 ServiceStack 服务,同时为浏览器和本地桌面和移动服务提供服务的能力客户。除了提供丰富的浏览体验之外,它还展示了如何使用 LLBLGen 提供丰富的类似 OData 的体验。

Matt Cowan 提供了一个good tutorial of how he built Nortwind.Data on his blog 并提供了一个很好的后续,展示了如何add Theming to ServiceStack Razor Views。

Real-time Order fulfillments

使用 ServiceStack、MVC、AngularJS、SignalR、Sqlite 和 Redis 构建的类似星巴克的实时订单履行单页应用程序。支持不同的用户角色,其中任何用户都可以创建订单,该订单被放置在队列中,并且可以由经过身份验证的“履行者”履行。

Social Bootstrap API

使用 ServiceStack + ASP.NET MVC 构建的基于 Backbone.js 的单页应用程序,展示了如何在单个应用程序中启用所有不同的 Authentication Providers,能够连接到社交 API 以及如何使用 @987654345 的不同方式@。

ServiceStack.UseCases

我们改变了创建演示应用程序的方式,而不是完整的独立示例应用程序,我们正在开发展示单个用例的单一用途应用程序。

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

所有 ServiceStack 示例项目都包含简单、独立、专注于单一用途的单页应用程序。

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 *** 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

ServiceStack 流行配置的不同工作启动模板:

At custom path, like /api At / root path A stand-alone HttpListener Console AppHost A Windows Service AppHost

【讨论】:

就在您认为自己阅读了 ServiceStack 上的所有内容时……这个菜鸟再次感谢您,Demis。 示例解决方案无法构建...太棒了。 我在任何示例项目中都看不到任何一致性。就像我打开一个,公约是全面的。我看到一些服务显示诸如 GetSomething 之类的动词与一些显示的 Get() 和 Put() 方法,我在任何地方都看不到在最佳实践等方面的一致性,我在一些项目中看到了路线,但在其他项目中没有看到(基于 Web 的项目) .我迷失在这一切中。 我想这与我使用 RESTful 服务获得的一个很好的例子一样接近 仅使用 ServiceStack + Redis 构建的迷你 *** 单页应用程序

以上是关于ServiceStack 示例应该以啥顺序被理解?的主要内容,如果未能解决你的问题,请参考以下文章

OpenCV 的 HoughLines 以啥顺序列出 [rho,theta] 矩阵中检测到的线?

PL/SQL 异常以啥顺序引发?

beforeEach 和 beforeAll 以啥顺序执行?

Visual Studio 以啥顺序编译源文件?

yaml-cpp 以啥顺序返回数据?

tensorflow::Tensor 的 flat 方法以啥顺序返回数据?