servicestack

Twitter Authentication in ServiceStack

最后都变了- 提交于 2019-12-25 07:13:49
问题 I added twitter Authentication in my ServiceStack Service. My Authentication as well as Service is working fine and i am getting redirected to my Service Page from Twitter Authentication page with success response. But i am not able to integrate this whole with my User Interface. There on button click event i want to successfully authenticated from twitter and after that want to get response from my service based on that i would redirect to my second webpage. Here is my web.config code..

servicestack pass forward slash in uri

↘锁芯ラ 提交于 2019-12-25 06:58:02
问题 I'm using servicestack to build a web api serving some old data over the web. Unfortunately the data schema does not lend itself particularly well to the standard use of ServiceStack.Ormlite. For example there are no primary keys and on one table the (non-unique) key actually can contain any characters. In my sample database there are '/' characters inside the key. Therefore when requesting a resource from the web api using this route "/api/objects/{objectCode}" if the required objectCode is

How to change sql server connection string dynamically in service stack

↘锁芯ラ 提交于 2019-12-25 06:37:48
问题 I am working on Asp.Net MVC and ServiceStack. I am trying to connect to the sql server database using servicestack ormlite. like var connectionString = ConfigurationManager.ConnectionStrings["AppDb"].ConnectionString; container.Register<IDbConnectionFactory>( new OrmLiteConnectionFactory(connectionString, SqlServerOrmLiteDialectProvider.Instance) { ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current) }); I am able to connect to database, But in my scenario i need to change

ServiceStack auto query global filter

青春壹個敷衍的年華 提交于 2019-12-25 04:44:09
问题 I'm looking at using ServiceStack's AutoQuery feature and I have some basic queries working. However I'd like to implement a global filter since I have a multi-tenanted database, e.g., All queries should be appended with the criteria CustomerId = Session.CustomerId What would be the best way to do this? 回答1: You could potentially use a custom AutoQuery base class for this to append the custom filter to each query, e.g: public abstract class MyAutoQueryServiceBase : AutoQueryServiceBase {

ServiceStack intercept requests before they are sent client side

送分小仙女□ 提交于 2019-12-25 03:36:32
问题 I have implemented a custom HMAC authentication for servicestack (example shown here). As suggested at the bottom of the link, I wanted to do something like this client side: var client = new JsonServiceClient(); client.LocalHttpWebRequestFilter += delegate(HttpWebRequest request) { // ContentType still null at this point so we must hard code it // Set these fields before trying to create the token! request.ContentType = ServiceStack.Common.Web.ContentType.Json; request.Date = DateTime.Now;

service stack angularjs with ravendb, proper approach

半世苍凉 提交于 2019-12-25 03:34:24
问题 I've created service stack angularjs vs template application. Initally I have • X.AngularJS • X.AngularJS.ServiceInterface • X.AngularJS.ServiceModel • X.AngularJS.Tests I'm using RavenDb as datastore. On X.AngularJS there is AppHost.cs configuration object where I'm defining DocumentStore and access to database. public override void Configure(Container container) { var store = new DocumentStore() { Url = "http://...", DefaultDatabase = "somedb" }.Initialize(); ... } Now, if I create Service

JsonServiceClient adding path to url

ε祈祈猫儿з 提交于 2019-12-25 02:58:37
问题 I'm using a JsonServiceClient, initialized with the url parameter like: JsonServiceClient client = new JsonServiceClient("http://dis.dat/whatever/coolService"); client.Post(new MyRequest{ Foo = "bar"}); But when i check for the output url, I can see that the service used a different URL, more precisely http://dis.dat/whatever/coolService/json/reply/MyRequest The request type is as simple as public class MyRequest { public string Foo {get; set;} } Of course, I would like to prevent this

ServiceStack How generate an Json response with only the Primary Key?

ⅰ亾dé卋堺 提交于 2019-12-25 02:29:45
问题 When I create a new record in my table I would like generate an json response with only the primary ID of my new record, somethink like : {"PrimaryID":123} I actually use this handmade function: // Inserts a new row into the PatientSession table public string AddPatientSession(PatientSession p) { int id = (int)_dbConnection.Insert<PatientSession>(p, selectIdentity: true); string Idconvert = id.ToString(); string IdInsert = "{\"PatientSessionId\":" + Idconvert + "}"; return IdInsert; } But I

Force ServiceStack to include a null field in JSON output?

谁说我不能喝 提交于 2019-12-25 02:11:47
问题 This is the object definition: Public Class ApplicationError Public Property Id As Integer Public Property Application As Application ' object defined elsewhere Public Property Task As String Public Property Description As String Public Property ErrorTimestamp As DateTime Public Property RestartTimestamp As DateTime? ' <-- nullable Public Property ApplicationStopped As Boolean End Class The response message definition contains a property Result() As ApplicationError . The JSON produced looks

Use the JWT tokens across multiple domains with Typescript JsonServiceClient - ServiceStack

狂风中的少年 提交于 2019-12-24 18:47:48
问题 After getting answers to this SO question, I realized that I have a cross-domain issue with the httponly flagged ServiceStack bearerToken Cookie not being sent to my resource microservices on different domains. ServiceStack's documentation explains how to solve this problem in their documentation here. I having trouble implementing a Typescript version of the code sample in ServiceStack's documentation. I am guess that the sample code in the documentation is C#. Here is my Typescript code