servicestack

Server Events Client - Getting rid of the automatically appended string at the end of the URI

强颜欢笑 提交于 2019-12-13 16:17:10
问题 I am new to the Service Stack library and trying to use the Server Events Client. The server I'm working with has two URIs. One for receiving a connection token and one for listening for search requests using the token acquired in the previous call. I use a regular JsonServiceClient with digest authentication to get the token like so: public const string Baseurl = "http://serverIp:port"; var client = new JsonServiceClient(Baseurl) { UserName = "user", Password = "password",

ServiceStack not rendering Razor View, only seeing Snap Shot

a 夏天 提交于 2019-12-13 15:23:21
问题 I've set up a very basic ServiceStack project with Bootstrap and I'm trying to get it to see my homepage (Razor View) which it doesn't, so I get the Snapshot of my homepage. Here are the steps I take to create the project: Create new Project "ServiceStack ASP.Net with Bootstrap" Open Nuget Server Console to download misssing Servicestack Packages. Build. Renamed Services.cs to MyStuffServices.cs and Model.cs to MyStuffModel.cs Added to 'AppHost.cs': SetConfig(new HostConfig {

Can ServiceStack operation naming convention be overriden?

送分小仙女□ 提交于 2019-12-13 14:42:21
问题 I need to define a DTO class for a ServiceStack service. Service stack uses convention based on class names, so if my class is called Transmission, the corresponding service will use expose metadata with a type "Transmission" used in HTTP operations. But I already have Transmission class - the one my DTO object will be mapped to. To avoid confusion I want to define TransmissionRequest DTO (probably something better than just "Request" suffix) but keep "Transmission" in exposed service

How to enable swagger in ServiceStack?

点点圈 提交于 2019-12-13 13:02:06
问题 I found mention of swagger in the Introductory Slides. But nowhere else. Is is something not finished yet? Edit: Apparently it's on To Do List. Is there any good way to document the RestAPI automatically? 回答1: According to Trello it was a "Doing" but has then been moved back to "To Do"; and there's a Swagger.Api module in the github repo, so assuming it's only partially finished. Edit As pointed out already (but for the sake of completeness, as this was the accepted answer), SwaggerUI is

Check authorize in SignalR attribute

懵懂的女人 提交于 2019-12-13 12:26:31
问题 i have some services on ServiceStack and use SignalR in this project. And now, i would like to secure hub connection (access only for authenticated users), but i use ServiceStack framework authentication.. (not asp.net authentication) and ServiceStack's sessions (write AuthUserId ih this session and authentication flag). So, when user trying connect to the hub -- hub must to check authentication... (yes, i can request Cookies from Hub (method OnConnected, for example), but SignalR check

ServiceStack 'session' missing?

半腔热情 提交于 2019-12-13 05:59:56
问题 new to this and trying to follow a tutorial on Pluralsight. A simple row of code: var trackedData = (TrackedData)Session[date.ToString()]; has Session underlined with red and I have not succeeded in getting rid of it. When the tutor's mouse hovered over the session, following tip was displayed. ServiceStack.CacheAccess.ISession Service.Session But somehow I couldn't get it into the solution. I have installed ServiceStack, ServiceStack.Host.MVC, ServiceStack.Host.AspNet and more. 回答1: Inside a

How to render Razor in cshtml page with Servicestack without content page

折月煮酒 提交于 2019-12-13 05:20:33
问题 I have markdown in string property of my model and would like to render it onto page. If I have html in that same string property I would simply do: @Html.Raw(Model.BodyHtml) Is there a same thing if string contains Markdown rather than Html? I.e. something like: @Html.MarkdownToHtml(Model.BodyMarkdown) 回答1: The new @Html.RenderMarkdownToHtml() API for this has just been added in v4.0.34+ that's now available on MyGet, which will let you render markdown with: @Html.RenderMarkdownToHtml(Model

Servicestack Ormlite Automapping

时光毁灭记忆、已成空白 提交于 2019-12-13 03:56:05
问题 I have started using ServiceStack and OrmLite for the first time and have got myself in a bit of a pickle. I have built 2 classes, 1 is to take the input parameters and 1 is to hold the response. Here they are... [DataContract] public class EMEM { public int EMCo { get; set; } public string Location { get; set; } public string Department{ get; set; } [DataMember] public string Equipment { get; set; } [DataMember] public string udDriver { get; set; } [DataMember] public string udDrillRigCrew {

Set Cache-Control: no-cache on GET requests

北战南征 提交于 2019-12-13 02:19:32
问题 I am trying to set the Cache-Control header on the response for GET request. This works, with OPTIONS requests: PreRequestFilters.Add((httpRequest, httpResponse) => { if (httpRequest.HttpMethod == "OPTIONS") { httpResponse.AddHeader("Cache-Control", "no-cache"); httpResponse.EndServiceStackRequest(); } }); This does not work, with GET requests: ResponseFilters.Add((httpRequest, httpResponse, dto) => { httpResponse.AddHeader("Cache-Control", "no-cache"); }); The filters are working... Also I

ORMLite OpenTransaction batch Insert & Getting back new Guids

旧时模样 提交于 2019-12-13 02:15:57
问题 I am trying to use ServiceStack ORMLite to run this: using (var o = Conn.OpenDbConnection()) { using (var t = o.OpenTransaction()) { foreach(var item in items) o.Insert(item); t.Commit(); //now, how do I get back the new item ids I have just inserted? } } In the code, how do I get back the batch new Ids? Also noticed the non-batch version GetLastInsertId() only return a Long. What do I do when my Id type is a GUID? Thank you. Also, while you are here, I would like to also ask, if t.Commit();