servicestack

Isolating/Accessing set session information within custom validator, servicestack API

无人久伴 提交于 2019-12-11 02:01:14
问题 I was wondering the best way of accessing the a user's AuthSession from within a custom validator we have hooked up via the servicestack's fluent-validation API hooks. Basically, the requirements are forcing us to access the database through this validator using a class called " DocNumberValidator ". The user's Id is saved into session when they authenticate, down the line we need this information to complete a successful SQL query. How does one access this session information (see below....)

ServiceStack: Access Session info from Javascript

我只是一个虾纸丫 提交于 2019-12-11 01:55:12
问题 I'm creating a SPA using ServiceStack and AngularJs. When a user logs in I set some variables in the OnAuthenticated method: public override void OnAuthenticated(IServiceBase authService, IAuthSession session, IOAuthTokens tokens, Dictionary<string, string> authInfo) { var sessionUser = session.TranslateTo<AppUserSession>(); var user = _userRepo.LoadUser(session.UserAuthName); var userSettings = ConfigurationSettings.Load(user); var customers = _customerRepo.ToList(); sessionUser.UserName =

What is the namespace for IService interface?

心不动则不痛 提交于 2019-12-11 01:54:25
问题 I am learning ServiceStack and developing simple demo for helloworld, but could not find namespace for ISservice interface, my code as per below: public class Hello { public string name { get; set; } } public class HelloResponse { public string Result { get; set; } } public class HelloService : **IService**<Hello> { public object Execute(Hello request) { return new HelloResponse { Result = "Hello" + request.name }; } } public class HelloAppHost : AppHostBase { public HelloAppHost() : base(

ServiceStack.DataAnnotations missing attributes definitions?

给你一囗甜甜゛ 提交于 2019-12-11 01:20:04
问题 I'm trying to use ServiceStack's attribute decorators from ServiceStack.DataAnnotations but when I view the ServiceStack.DataAnnotations namespace in the MSVS Object Browser, there are only the following types: ComputeAttribute DecimalLengthAttribute IgnoreAttribute PrimaryKeyAttribute I have the latest bins and all of my references check out. Specifically, I'm looking to use the [AutoIncrement] and [Index] attribs. Thanks 回答1: The [AutoIncrement] and [Index] attributes are in the

Virtual file not found using servicestack 4.0.5 after adding Telerik OpenAccess datacontext

白昼怎懂夜的黑 提交于 2019-12-11 00:58:34
问题 I'm testing out the new 4.0.5 Service stack (previously I was using version 3), and starting afresh I just can't seem to get my service to start when I add Telerik OpenAccess. I'm using Telerik's OpenAccess to talk to a MSSQL database again, which all works fine using version 3.x - As soon as I add in the Telerik Domain model I get a "Virtual File Not Found" Virtual file not found Description: An unhandled exception occurred during the execution of the current web request. Please review the

Transactional Create with Validation in ServiceStack Redis Client

别说谁变了你拦得住时间么 提交于 2019-12-11 00:57:23
问题 User has DisplayName and it is unique for Users. I want to Create User but firstly I have to check display name (DisplayName could not be duplicated for Users) I've checked ServiceStack examples and I could not see Transactional Insert/Update with validation check. How can I perform it. I dont want to write "Validation Tasks" for redis db. I dont want inconsistency in db. 回答1: The ServiceStack.Redis client does have support for Redis's WATCH and transactions where these Redis commands: WATCH

HTTP GET method parameter format for object

こ雲淡風輕ζ 提交于 2019-12-11 00:54:22
问题 Can I set my request object by http parameters with GET method, if request contains not primitive object. I can do it for POST method with json, but does exist some GET alternative? [DataContract] [RestService("/foo")] public class FooRequest { [DataMember] public string Color1 { get; set; } [DataMember] public FooDto Dto { get; set; } } public class FooDto { public string Color2 { get; set;} } In this example Color1 is set but how can I set Dto.color2? http://server/fooservice/servicestack

Costomising the serialisation/serialised JSON in service stack

為{幸葍}努か 提交于 2019-12-11 00:38:14
问题 I need to turn this beutifull default JSON from Service Stack : { "Status": "ok", "LanguageArray": [{ "Id": 1, "Name": "English" }, { "Id": 2, "Name": "Chinese" }, { "Id": 3, "Name": "Portuguese" }] } To this monstrosity of abomination: {"status":"ok","language":{ "0":{"id":"1", "name":"English"}, "1":{"id":"2", "name":"Chinese"}, "2":{"id":"3", "name":"Portuguese"}, } For reasons beyond my control or ration or logic. My question is what are the simplest way of achieving this? I need to do

Authenticate server to server communication with API key

亡梦爱人 提交于 2019-12-11 00:21:55
问题 I have a couple of self-hosted windows services running with ServiceStack. These services are used by a bunch of WPF and WinForms client applications. I have written my own CredentialsAuthProvider . My first implementation of the user database was on MSSQL server using NHibernate. Now since the system is growing I reorganize things a bit. I have created a central 'infrastructue' service which uses Redis as data store and is responsible for account management, central configuration and

Servicestack ORMLite/Massive managing multiple DataTables with Expandos / Dynamic?

假如想象 提交于 2019-12-11 00:07:35
问题 i have a Stored Procedure that returns multiple datatables with dynamic types according to the input and I cannot modify or split it. I actually retrieve the data in this way: var massiveModel = new DynamicModel(dbConn.ConnectionString); var connection = new SqlConnection(@"Data Source=127.0.0.1;Initial Catalog=TEST;User ID=as;Password=;Application Name=BRUCE_WAYNE"); connection.Open(); var massiveConnection = connection; var tmp = massiveModel.Query("exec MY_SP 4412 '20131016' ",