servicestack

ServiceStack : routes and parameters

…衆ロ難τιáo~ 提交于 2019-12-06 13:02:52
问题 Just discovered ServiceStack last months and i really enjoy working with this great framework. Was reaaly fed up with WCF settings and static method prototyping ! I have a question ! I have created a class : Events that allows to display one or a List of Events using following Routes : [Route("/events")] [Route("/events/{Id}")] public class Event { public ushort Id { get; set; } public string FromDate { get; set; } public string ToDate { get; set; } } But i would also like to list events

path parameters w/ URL unfriendly characters

ぃ、小莉子 提交于 2019-12-06 11:45:17
Using service stack 3.9.21. Hosting the app in IIS 7.5. Using an Integrated 4.0.30319 ASP.NET app pool. For illustration purposes let's say I have the following path (that is backed by a DTO and a corresponding request handler): /cars/{id} Some cars' ids have characters in them that I suppose have to be URL encoded - pipe, |, is one of them. When I send requests to fetch a car with for example an id of '1|2' I get a good old 500 with the following stack trace: [ArgumentException]: Illegal characters in path. at System.IO.Path.CheckInvalidPathChars(String path) at System.IO.Path.GetFileName

Purpose of IReturn and IReturnVoid within JsonServiceClient.Get

家住魔仙堡 提交于 2019-12-06 11:36:03
问题 Is there a reason why I need to supply IReturn or IReturnVoid references to ServiceStack's JsonServiceClient.Get? There must be a good reason (I'm quite new to the framework) but I don't understand why I have to convert my objects to IReturn wrappers or make them ServiceStack dependant. I have read those posts but couldn't find the explaination I am looking for (only workarounds): ServiceStack: JsonServiceClient usage without IReturn in DTO ServiceStack IReturn Thanks! 回答1: JSON is an untyped

ServiceStack Razor - “Forbidden” error for default document

女生的网名这么多〃 提交于 2019-12-06 11:35:05
问题 I am creating a ServiceStack based website using the Razor format engine. In the folder root of my project I have "default.cshtml", but attempting to navigate to the URL (on localhost) I receive a 302 redirect to default.cshtml and the following page: Forbidden Request.HttpMethod: GET Request.PathInfo: /default.cshtml Request.QueryString: Request.RawUrl: /default.cshtml Here is my Global.asax.cs: public class AppHost : AppHostBase { public AppHost() : base("OOMS 2.0", typeof(OOMS

What is the most time efficient way to serialize/deserialize a DataTable to/from Redis?

对着背影说爱祢 提交于 2019-12-06 11:02:58
I want to store complex objects such as a DataTable or Dataset , etc, in Redis. I have tried to serialize them as a BLOB object using JsonSerialize , but it takes too much time. Is there any other way? Unfortunately when working with large data sets it will always take time to serialize and deserialize the structure. DataTable s in particular are fairly complex objects, as they have rows and columns which often have a lot of meta data attached to them - even when it appears to be a basic table. DataTable vs List<POCO> : Consider whether you really need to be serializing as a DataTable . Could

ServiceStack Route design

一曲冷凌霜 提交于 2019-12-06 10:22:50
问题 Are these 3 routes the same? Which one is normally preferred? [Route("/todo/{id}", "DELETE")] [Route("/todo/delete","POST")] [Route("/todo/delete/{id}","GET")] public class DeleteTodo : IReturnVoid { public int Id { get; set; } } Thank you very much... 回答1: The preferred route is actually to include the Id in the pathinfo since DELETE requests don't have a HTTP Request Body you can submit this info on, e.g: [Route("/todo/{id}", "DELETE")] public class DeleteTodo : IReturnVoid { public int Id

Separate or combined ServiceStack services?

时光怂恿深爱的人放手 提交于 2019-12-06 10:17:27
问题 I want to have ServiceStack endpoints such as the following... [RestService("/items/recent")] [RestService("/items/recent/{Page}")] [RestService("/items/popular")] [RestService("/items/popular/{Page}")] Since both would return a List<Item> , I'd love to be able to have both of these in the same RestServiceBase for easier code management. Is this possible? If so, how can I differentiate the request when it comes in to find whether it was a "recent" or "popular" request so that I can handle it

Does ORMLite support dynamic Type of C#?

主宰稳场 提交于 2019-12-06 09:17:48
问题 I am looking into ORMLite from ServiceStack and what I am trying to do here is that call a stored procedure which in turn return many many rows which definitely would not be bound to any domain object but also may or may not have a dto object to map with. I was wondering if I can bind it to a type. However, it sounds like ORMLite does not support dynamic type binding at this time. Does ORMLite support at this point? 回答1: By design OrmLite does not support marshalling to dynamic types, and

servicestack self-hosted service uses chunked encoding - is unbuffered?

自闭症网瘾萝莉.ら 提交于 2019-12-06 09:07:57
I am trying to learn ServiceStack with the hello world examples and self-hosted example. I am making requests for JSON content. I have noticed the following in the response headers: Basic service hosted in an ASP.Net project: HTTP/1.1 200 OK Server: ASP.NET Development Server/10.0.0.0 Date: Wed, 10 Apr 2013 12:49:46 GMT X-AspNet-Version: 4.0.30319 X-Powered-By: ServiceStack/3.943 Win32NT/.NET Cache-Control: private Content-Type: application/json; charset=utf-8 Content-Length: 16 <------------------------------------- Connection: Close Same basic service, self-hosting (command line): HTTP/1.1

Two service stack APIs on the same IIS server

青春壹個敷衍的年華 提交于 2019-12-06 08:59:05
I'm currently in a situation where I need to deploy multiple Service Stack API's to the same server and getting an 'AppHostBase. Instance has already been set'. I've found this link: ServiceStack AppHost Is a Singleton? but it seems to be related to multiple versions of related APIs or versioned APIs. This is not my scenario. How can I (or is there a way to) configure multiple Service Stack API's which are completely unrelated and do not have any knowledge of each other to run simultaneously on the same server? You should be able to setup two different applications in IIS as long as they run