servicestack

how to refresh token servicestack typescript

て烟熏妆下的殇ゞ 提交于 2019-12-11 07:26:33
问题 On servicestack it says that for regular client it should be like that but for typescript it should be somehow different. Anyone knows how to do it? var client = new JsonServiceClient(baseUrl); client.OnAuthenticationRequired = () => { client.BearerToken = authClient.Send(new Authenticate()).BearerToken; }; 回答1: Support for onAuthenticationRequired and refreshToken was added to the TypeScript servicestack-client in v0.0.32 where they can be used to transparently handle 401 Unauthorized

Entity Framework navigation property

我的未来我决定 提交于 2019-12-11 07:18:26
问题 I'm trying to use EF to get data from my database. I have a table Interventions that has a Client associated with it like this: public partial class Client { public Client() { this.Interventions = new List<Intervention>(); } public int client_id { get; set; } public string full_name { get; set; } public string cgroup { get; set; } public string nation { get; set; } public virtual ICollection<Intervention> Interventions { get; set; } } public partial class Intervention { public int

How to configure ServiceStack.Text to use EnumMember when serializing to csv or jsv?

时间秒杀一切 提交于 2019-12-11 06:55:18
问题 This is a follow up question to my earlier question about ServiceStack.Text and deserializing json to .Net enums. The answer to that question resolves how to get ServiceStack.Text to use .Net DataContract and EnumMember to map strings to enum values. Now I am trying to serialize the same enums to various formats and while json serialization is working in a round-trip way as expected, both csv and jsv conversion are ignoring the data contract. Is there a way to configure ServiceStack.Text

Session expiry value starts off ok, then changes to default

孤街醉人 提交于 2019-12-11 06:39:48
问题 I have a special case when I'm trying to set my session to expire in 30 minutes. My code that saves the session looks like below. When I set a breakpoint here, the value of the variable is what I want (30min). When I step over the SaveSession line, the row in my cache has an ExpiryDate of 30 minutes away. However, something is changing the ExpiryDate in the cache back to the default of 2 weeks and I'm not sure what that could be. This line is the only .SaveSession in my entire service.

Is it possible to do sub-query join using ServiceStack's OrmLite?

五迷三道 提交于 2019-12-11 06:33:34
问题 Is it possible to do sub-query join using ServiceStack's OrmLite? Something like this? var q = Db.From<Customer>() .Join<Customer, subq>((c, subq) => c.CustomerID == subq.CustomerID) 回答1: There's no Typed API support for joining on a sub select but you can use a CustomJoin to do this, e.g: var q = Db.From<Customer>() .CustomJoin("INNER JOIN (SELECT Id FROM ...) sub ON sub.Id = Customer.Id") 来源: https://stackoverflow.com/questions/44899741/is-it-possible-to-do-sub-query-join-using

ServiceStack.Text: Forcing serialization of a property not decorated with DataMember attribute

…衆ロ難τιáo~ 提交于 2019-12-11 06:27:32
问题 I have the following class (simplified). [DataContract] public class ServiceResponse { public int Sequence { get; set; } [DataMember] public ServiceResponseStatus Status { get; set; } } I'm using ServiceStack to serialize objects for logging purposes, and letting DataContractSerializer do the rest. ServiceStack, as expected, will not serialize Sequence as it is not decorated with a DataMember attribute. Is there a way to force ServiceStack to serialize this property? Marc Gravell's answer to

Revoking Bearer Token and Refresh Token - ServiceStack

懵懂的女人 提交于 2019-12-11 06:24:57
问题 I want to enforce a single user session feature for my Angular app because my customers share a single account with their coworkers. The issue currently, with my implementation. is revoking a valid token stored a client's local storage, particularly a valid Refresh token. The scenario is: User 1 logs in with valid username and password, the bearer token will expire in an hour, the refresh token will expire in two weeks User 2, uses the same username and password two hours later. User 2 is

Is RequestFilter Validation client dependent?

跟風遠走 提交于 2019-12-11 06:23:54
问题 Should I expect Request Filter Validation (e.g. FluentValidation) to be triggered when instantiating a reference service via AppHostBase.ResolveService<> ? Thus far, I've only successfully received proper error responses to my C# application when using the typed clients (JsonServiceClient in this case specifically). 回答1: You are right. If you try use AppHostBase.ResolveService<T> it does not execute any of the registered request filters. Essentially it only resolves the Service from the

ServiceStack.Text json only serialize struct properties

萝らか妹 提交于 2019-12-11 06:23:13
问题 Is it possible to make ServiceStack.Text sterilize public fields of a struct just like the .net JavaScriptSerializer does? Currently if a struct does not define a filed as a property, i.e. property keyword in c++ or get;set; in c# the value does not get serialized. 回答1: This is not currently possible with ServiceStack serializers. By design ServiceStack serializers tries to promote the use of special purpose DTOs for use in the service layer/boundary of your services, in this goal we only

AppHostBase instance not set

心已入冬 提交于 2019-12-11 06:13:51
问题 Like many of my ServiceStack questions, I'm sure this will be pretty easy. I have an asp.net MCC4 application in which I am using ServiceStack for authentication. Because the cookies generated by the ServiceStack client aren't shared, I've followed the response in questions like this to resolve the issue: ServiceStack Session always null in MVC Controller In my client I have this snippet of code: var authService = AppHostBase.Resolve<AuthService>(); authService.RequestContext = System.Web