關注@servicestack或查看文檔,使用Stackoverflow或客戶論壇進行支持。
查看最新功能的發行說明,或查看serviceStack.net/features以獲取概述。
ServiceStack是一種簡單,快速,通用和高度生產力的全網絡和Web服務框架,經過深思熟慮,旨在通過基於消息的設計來降低人造複雜性並促進遠程服務的最佳實踐,從而最大程度地使用它,可以最大程度地利用,可以利用集成的服務網關來創建鬆散耦合的模塊化模塊化的模塊化型架構。 ServiceStack服務可通過一系列內置快速數據格式(Inc. JSON,XML,CSV,JSV,ProTobuf,Wire和MSGPACK)以及用於肥皂端點的XSD/WSDL,用於肥皂端點和兔子MQ,Redis MQ和Amazon SQS MQ主機。
它的設計和簡單焦點提供了一套無與倫比的生產力功能套件,可以在沒有代碼的情況下聲明地啟用,從創建完全可查詢的Web API,只有單個鍵入的請求DTO,並帶有自動查詢,可以為每個主要的RDBMS提供支持自動批次批次的請求的內置支持,或者輕鬆地允許使用豐富的HTTP緩存和無用的服務來實現所有現有的服務。
您的相同服務還可以作為ServiceStack的智能剃須刀視圖中的控制器,從而減少了為Web和單頁應用程序提供服務的努力,以及能夠使用ServiceStack的實時服務器事件提供即時交互體驗的豐富桌面和移動客戶端。
ServiceStack Services還為消費者最大化生產率,為消費者提供即時的端到端鍵入API,而無需代碼 - 代碼,從而為.NET到.NET Web服務提供了最有生產力的開發體驗。
ServiceStack now integrates with all Major IDE's used for creating the best native experiences on the most popular platforms to enable a highly productive dev workflow for consuming Web Services, making ServiceStack the ideal back-end choice for powering rich, native iPhone and iPad Apps on iOS with Swift, Mobile and Tablet Apps on the Android platform with Java, OSX Desktop Applications as well as targeting the most popular .NET PCL platforms including Xamarin.ios,Xamarin.android,Windows Store,WPF,Winforms和Silverlight:
直接在Visual Studio中為C#,Typescript,F#和VB.NET提供即時本機鍵入API,直接在Windows上使用Xamarin.ios和Xamarin.android,在Visual Studio中為最流行的.NET平台提供了最流行的.NET平台。
使用Xamarin.ios和Xamarin.Android提供C#本機類型,以使用OSX上的Xamarin Studio開發iOS和Android移動應用程序。 ServiceStackxs插件還提供了豐富的Web服務開發經驗,開發客戶端應用程序,並在Linux上開發了Mono
在SWIFT中提供即時的本機鍵入API,包括通用服務客戶端,從而直接從Xcode內部提供了高度生產的工作流程和輕鬆消費Web服務的Web服務!
在Java和Kotlin中提供即時的本機鍵入API,其中包括慣用的Java通用服務客戶端,支持Sync和異步請求,通過利用Android的異步異型,以啟用富含服務的本機Java或Kotlin移動應用程序在Android Platform上創建富含服務的本機Java或Kotlin移動應用程序 - 直接從Android Dutio室內!
ServiceStack Idea插件可直接從Intellij的插件存儲庫中安裝,並可以與Intellij Java Maven項目無縫集成,以生成類型的API,以快速而輕鬆地從純交叉平台Java或Kotlin客戶端使用遠程Servicestack Web服務。
Java Add Add Servicestack參考提供的無與倫比的生產率也可以在Eclipse Marketplace的ServiceStackeCeCeclipse IDE插件中獲得,可在Eclipse Marketplace中安裝,可將添加Servicestack參考與Eclipse Java Maven項目深入整合,促進Java開發人員輕鬆地添加和更新其Evolvant Endervand Servicestack Web Services的參考。
除了我們受支持的IDE列表不斷增長之外,Servicestack-CLI跨平台命令行NPM腳本也使構建服務器,自動化任務和您喜歡的文本編輯器的命令行跑步者可以輕鬆添加和更新ServiceStack參考!
此示例也可以作為獨立集成測試提供:
//Web Service Host Configuration
public class AppHost : AppSelfHostBase
{
public AppHost ( )
: base ( "Customer REST Example" , typeof ( CustomerService ) . Assembly ) { }
public override void Configure ( Container container )
{
//Register which RDBMS provider to use
container . Register < IDbConnectionFactory > ( c =>
new OrmLiteConnectionFactory ( ":memory:" , SqliteDialect . Provider ) ) ;
using ( var db = container . Resolve < IDbConnectionFactory > ( ) . Open ( ) )
{
//Create the Customer POCO table if it doesn't already exist
db . CreateTableIfNotExists < Customer > ( ) ;
}
}
}
//Web Service DTO's
[ Route ( "/customers" , "GET" ) ]
public class GetCustomers : IReturn < GetCustomersResponse > { }
public class GetCustomersResponse
{
public List < Customer > Results { get ; set ; }
}
[ Route ( "/customers/{Id}" , "GET" ) ]
public class GetCustomer : IReturn < Customer >
{
public int Id { get ; set ; }
}
[ Route ( "/customers" , "POST" ) ]
public class CreateCustomer : IReturn < Customer >
{
public string Name { get ; set ; }
}
[ Route ( "/customers/{Id}" , "PUT" ) ]
public class UpdateCustomer : IReturn < Customer >
{
public int Id { get ; set ; }
public string Name { get ; set ; }
}
[ Route ( "/customers/{Id}" , "DELETE" ) ]
public class DeleteCustomer : IReturnVoid
{
public int Id { get ; set ; }
}
// POCO DB Model
public class Customer
{
[ AutoIncrement ]
public int Id { get ; set ; }
public string Name { get ; set ; }
}
//Web Services Implementation
public class CustomerService : Service
{
public object Get ( GetCustomers request )
{
return new GetCustomersResponse { Results = Db . Select < Customer > ( ) } ;
}
public object Get ( GetCustomer request )
{
return Db . SingleById < Customer > ( request . Id ) ;
}
public object Post ( CreateCustomer request )
{
var customer = new Customer { Name = request . Name } ;
Db . Save ( customer ) ;
return customer ;
}
public object Put ( UpdateCustomer request )
{
var customer = Db . SingleById < Customer > ( request . Id ) ;
if ( customer == null )
throw HttpError . NotFound ( "Customer '{0}' does not exist" . Fmt ( request . Id ) ) ;
customer . Name = request . Name ;
Db . Update ( customer ) ;
return customer ;
}
public void Delete ( DeleteCustomer request )
{
Db . DeleteById < Customer > ( request . Id ) ;
}
}無需代碼,可以在服務器DTO上重複使用:
var client = new JsonServiceClient ( BaseUri ) ;
//GET /customers
var all = client . Get ( new GetCustomers ( ) ) ; // Count = 0
//POST /customers
var customer = client . Post ( new CreateCustomer { Name = "Foo" } ) ;
//GET /customer/1
customer = client . Get ( new GetCustomer { Id = customer . Id } ) ; // Name = Foo
//GET /customers
all = client . Get ( new GetCustomers ( ) ) ; // Count = 1
//PUT /customers/1
customer = client . Put (
new UpdateCustomer { Id = customer . Id , Name = "Bar" } ) ; // Name = Bar
//DELETE /customers/1
client . Delete ( new DeleteCustomer { Id = customer . Id } ) ;
//GET /customers
all = client . Get ( new GetCustomers ( ) ) ; // Count = 0相同的代碼也與Android,iOS,Xamarin.Forms,UWP和WPF客戶端一起使用。
f#和vb.net可以重複使用相同的.NET服務客戶端和DTO
const client = new JsonServiceClient ( baseUrl ) ;
const { results } = await client . get ( new GetCustomers ( ) ) ; let client = JsonServiceClient ( baseUrl : BaseUri )
client . getAsync ( GetCustomers ( ) )
. then {
let results = $0 . results;
} JsonServiceClient client = new JsonServiceClient ( BaseUri );
GetCustomersResponse response = client . get ( new GetCustomers ());
List < Customer > results = response . results ; val client = JsonServiceClient ( BaseUri )
val response = client.get( GetCustomers ())
val results = response.results var client = new JsonServiceClient ( BaseUri );
var response = await client. get ( GetCustomers ());
var results = client.results; $ . getJSON ( $ . ss . createUrl ( "/customers" , request ) , request , ( r : GetCustomersResponse ) => {
var results = r . results ;
} ) ;使用Angular HTTP客戶端使用打字稿定義:
this . http . get < GetCustomersResponse > ( createUrl ( '/customers' , request ) ) . subscribe ( r => {
this . results = r . results ;
} ) ; $ . getJSON ( baseUri + "/customers" , function ( r ) {
var results = r . results ;
} ) ;這就是創建和消費簡單的啟用數據庫REST Web服務所需的所有應用程序代碼!
如果您安裝了Nuget,則最簡單的入門方法是:
Nuget上的最新V4+是帶有免費配額的商業版本。
示例項目,用例,演示,入門模板的確定列表
自2013年9月以來,ServiceStack源代碼可根據GNU AFFERO通用公共許可/FOSS許可例外提供,請參見源中的LICENT.TXT。還提供替代商業許可,請參閱https://servicestack.net/pricing有關詳細信息。
貢獻者需要在審查任何代碼之前批准貢獻者許可協議,請參閱貢獻文檔以獲取更多詳細信息。所有貢獻都必須包括驗證所需行為的測試。
ServiceStack包含以下大庫的源代碼,以提供其某些核心功能。每個圖書館均根據其各自的許可發布:
關注@servicestack和 +ServiceStack以獲取項目更新。
非常感謝Github和ServiceStack的所有貢獻者:
類似的開源.NET項目用於開發或訪問Web服務包括: