servicestack

The simplest example of Knockback js working with a RESTful webservice such as ServiceStack?

梦想的初衷 提交于 2019-12-20 10:48:12
问题 I am looking for a VERY simple example that shows wiring up Knockback code to a backbone model that connects via RESTful service. I am using ServiceStack|c# backend. All of the links below are too complicated and use localStore rather than a RESTful service via url. I also prefer to see examples in Javascript not CoffeeScript. My example url is something like localhost/entities where hitting this will cause the RESTful webservice to return all of the entities. Hitting it with localhost/entity

Updating Service Stack Redis List

自作多情 提交于 2019-12-20 10:43:20
问题 Is there a correct way to update a IRedisList? With the sample code below, I can modify it to remove the list, update the pizza and the re-add the list, but that feels wrong. The command line documentation is pretty thourough, but it's a much bigger project than I though and I'm not entirely sure where to start looking. public void UpdatePizza(Pizza pizza) { using (var redisClient = new RedisClient(Host, Port)) { IRedisTypedClient<Pizza> redis = redisClient.As<Pizza>(); IRedisList<Pizza>

How to use Servicestack Authentication with Active Directory/Windows Authentication?

白昼怎懂夜的黑 提交于 2019-12-20 09:39:30
问题 I am creating a secure (SSL) public service where the users credentials reside in Active Directory. I want to leverage ServiceStack's Authentication and have read over the wiki article. I already have code written to verify the user credentials with AD. I have a few questions. Which Auth provider do I use? Credentials, Basic Auth or Custom? The service requires SSL so Basic Auth would be safe, however passwords would be encrypted for added safety. Do I still need to store the UserAuth and

Transition from Entityspaces(Tiraggo) into Servicestack Ormlite

风格不统一 提交于 2019-12-20 04:22:09
问题 at this moment we are migrating from Entityspaces(Tiraggo) into Servicestack Ormlite. One point is the way to open and close the DBConnection. I apologize for the comparission but it is useful for the question. In Tiraggo, inside my wep application, in the global.asax.cs I put this: protected void Application_Start(object sender, EventArgs e) { Tiraggo.Interfaces.tgProviderFactory.Factory = new Tiraggo.Loader.tgDataProviderFactory(); } In web.config exists the section for Tiraggo, the

ServiceStack NuGet update 4.0.22 to 4.0.31 caused errors on deployment

╄→гoц情女王★ 提交于 2019-12-20 03:52:50
问题 I'm hoping not to be to vague here, but I've just done a NuGet update for ServiceStack, updating from version 4.0.22 to 4.0.31, the project compiles fine but once deployed to iis I'm getting this error when I hit the site. Method 'get_Cookies' in type 'ServiceStack.Host.AspNet.AspNetRequest' from assembly 'ServiceStack, Version=4.0.31.0, Culture=neutral, PublicKeyToken=null' does not have an implementation. Wondering if anyone else is having this error? 回答1: A side-effect of ServiceStack

Is there a way to ignore default values during serialization with ServiceStack json?

僤鯓⒐⒋嵵緔 提交于 2019-12-20 01:41:12
问题 I am using Entity Framework as my ORM. It has ComplexTypeAttribute (which is used to annotate POCO's). Properties that are complex types, are always instantiated (using default constructor), regardless of their value; And as a consequence, are always serialized by ServiceStack JsonSerializer (along with their properties). JSON.NET has an enum called DefaultValueHandling , which can be used in these situations. Does ServiceStack have something similar? For example: class Person { string Name {

ServiceStack AppHostHttpListenerBase Unable to connect to the remote server

ぃ、小莉子 提交于 2019-12-20 01:08:37
问题 I'm working through some Functional Tests on my app, and I think I'm getting pretty close. My problem is that when I run my first test, I get the error. unable to connect to the remote server. Expected: OK But was: 0 I can confirm that if I put a breakpoint on the Assert, and then try to hit the BaseUrl in my browser, it is not found. Here's my test. [Test] public void MyTestTest () { var client = new RestClient( ServiceTestAppHostBase.BaseUrl ); // client.Authenticator = new

Override field name deserialization in ServiceStack

孤街醉人 提交于 2019-12-19 12:25:54
问题 I'm using ServiceStack to deserialize some HTML form values but can't figure out how to override the value that each field should be read from. For example, the form posts a value to first_name but the property on my POCO is called FirstName . how would I do mapping like that in ServiceStack 回答1: The ServiceStack Text serializers support [DataMember] aliases where you can use the Name parameter to specify what alias each field should be, e.g: [DataContract] public class Customer { [DataMember

Override field name deserialization in ServiceStack

心不动则不痛 提交于 2019-12-19 12:25:13
问题 I'm using ServiceStack to deserialize some HTML form values but can't figure out how to override the value that each field should be read from. For example, the form posts a value to first_name but the property on my POCO is called FirstName . how would I do mapping like that in ServiceStack 回答1: The ServiceStack Text serializers support [DataMember] aliases where you can use the Name parameter to specify what alias each field should be, e.g: [DataContract] public class Customer { [DataMember

How can you change the default ContentType in ServiceStack?

試著忘記壹切 提交于 2019-12-19 10:27:57
问题 I have registered a new content type in ServiceStack with: appHost.ContentTypeFilters.Register("application/x-my-content-type", SerializeToStream, DeserializeFromStream); And everything works as expected, if the client sends the content type in the http stream. Unfortunately, I have a client that is not in my control of HTTP Request Heads and does not send the content type. How can I get ServiceStack to set the default content type for that route? 回答1: On every ServiceStack /metadata page