servicestack

Many to many relations with ServiceStack.OrmLite

会有一股神秘感。 提交于 2019-11-29 00:15:40
I've been checking ServiceStack's documentation, but I haven't found a way to do many to many relationships with ServiceStack.OrmLite, is it supported? Is there a workaround (without writing raw sql)? I'd like to have something like this: Article <- ArticleToTag -> Tag Thanks!! It's not implicitly handled automatically for you behind the scenes if that's what you mean? But as OrmLite is just a thin wrapper around ADO.NET interfaces anything is possible. In OrmLite , by default every POCO maps 1:1 with a table. So if you wanted the table layout you would create it just as it looks in your

ServiceStack default format

喜夏-厌秋 提交于 2019-11-28 23:07:15
I would like to set ServiceStack's default format to JSON, as opposed to the HTML formatted response it normally returns when a service is accessed from a browser. I know this can be specified on each request by sending a ?format=json parameter or setting the Accept header to application/json. Is there a way to change this without having to rely on these hints from the request? In addition to specifying it on the QueryString with ?format=json , by appending the format .ext to the end of the route, e.g: /rockstars.json , or by specifying the HTTP Header (in your HttpClient): Accept: application

How to use ServiceStack authentication correctly in ASP.Net MVC controller

大兔子大兔子 提交于 2019-11-28 21:29:49
I'm having problem with getting ServiceStack [Authentication] attribute to work in ASP.Net MVC4 controller, pages / action methods with the attribute keep redirecting Users to the login page even after the login details are submitted correctly. I've followed the SocialBootstrapApi example, with the difference being that all the authentication web service calls are made from the controllers: this.CreateRestClient().Post<RegistrationResponse>("/register", model); Other things that I've done so far: Use my own user session implementation subclassing AuthUserSession (not too different from the

Is this a valid usage of ServiceStack Redis?

会有一股神秘感。 提交于 2019-11-28 20:49:46
I am new to Redis (using it at a hosted service) and want to use it as a demonstration / sandbox data storage for lists. I use the following piece of code. It works - for me. But is it a valid (and not completely bad practice) usage for a small web site with several (up to 100) concurrent users (for a small amount of data - up to 1000 list items)? I'm using static connection and a static redisclient typed list like this: public class MyApp { private static ServiceStack.Redis.RedisClient redisClient; public static IList<Person> Persons; public static IRedisTypedClient<Person> PersonClient;

How to get Swagger to send API key as a http instead of in the URL

≯℡__Kan透↙ 提交于 2019-11-28 20:14:28
问题 I am using swagger with servicestack but I am getting a 401 unauthorised error from my /resources URL becuase it requires an API key. Unless I'm mistaken, according to the documentation I should set supportHeaderParams to true as well as the apiKeyName and apiKey value in the JSON parameters when initializing Swagger from my html page. I was then expecting to see my API key in the http request headers, but it is still being appended to the URL and not in the headers collection. Here is the

How does ServiceStack handle concurrent calls?

杀马特。学长 韩版系。学妹 提交于 2019-11-28 17:37:51
How does ServiceStack handle concurrent calls? I'm looking for equivalent of ConcurrencyMode.Multiple in WCF. My WCF services have this attribute set: [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = false)] Do I need to enable anything in ServiceStack to get it to use multiple threads for each call? ServiceStack doesn't have a configurable concurrency model per AppHost, it is dependent upon the AppHost you choose to host your ServiceStack services with: ASP.NET Host (AppHostBase) For ASP.NET web hosts,

How can I use a standard ASP.NET session object within ServiceStack service implementation

眉间皱痕 提交于 2019-11-28 16:45:12
I'm just getting started with ServiceStack and, as a test case, I am looking to rework an existing service which is built using standard ASP.Net handlers. I've managed to get it all working as I want it but have certain aspects which make use of the ASP.Net Session object. I've tried adding IRequiresSessionState into the service interface: public class SessionTestService : RestServiceBase<SessionTest>, IRequiresSessionState { public override object OnPost(SessionTest request) { // Here I want to use System.Web.HttpContext.Current.Session } } The trouble is I can't seem to get it to work as the

What's the current best solution for generating HTML from ASP.NET Razor templates within a Console Application?

无人久伴 提交于 2019-11-28 16:25:34
问题 I want to do this: string template = "Hello @Model.Name! Welcome to Razor!"; string result = Razor.Parse(template, new { Name = "World" }); And it appears that http://razorengine.codeplex.com is perfect, except it's a year old. EDIT: Turns out that RazorEngine has moved to GitHub and had a commit a few months back: https://github.com/Antaris/RazorEngine I noticed that Service Stack has some Razor self-hosting but while there's a long page here http://razor.servicestack.net there's no "hello

Deserializing JSON that has an int as a key in C#

早过忘川 提交于 2019-11-28 12:26:54
I am trying to deserialize this JSON { "39": { "category": "Miscellaneous", "country_whitelist": [], "name": "domain.com", "url_blacklist": [], "country_blacklist": [], "url_whitelist": [ "domain.com" ], "deals": { "425215": { "status": "Ok", "type": "", "code": "CODE", "end_date": "2014-03-01 04:00:00", "title": "RandomTitle", "url": "http://domain.com/foo", "text": "Text Text Text", "long_title": "Longer Text" }, "425216": { "status": "Ok", "type": "", "code": "CODE2", "end_date": "2014-03-01 04:00:00", "title": "RandomTitle2", "url": "http://domain.com/bar", "text": "Text Text Text", "long

Json Format data from console application to service stack

谁说胖子不能爱 提交于 2019-11-28 11:36:31
I found you are the only one who answers for service stack, I don't have emails and what ever you provided for last questions to me, seems fine. I have seen your profile and as you are the main founder of mythZ, i seems to ask you my question again. For one of my question, POST data in JSON format to Service stack, i appreciate your answer. your answer is right, however in my case i am having following case.Let me describe in more detail. I have seen "Hello World" example of service stack. I got link for https://github.com/ServiceStack/ServiceStack.Extras/blob/master/doc/UsageExamples