servicestack

Access Servicstack.net session in validator

蹲街弑〆低调 提交于 2019-12-01 06:51:57
问题 How can I access a ServiceStack.net session in my validation code? public class UserSettingsValidator : AbstractValidator<UserSettingsRequest> { public UserSettingsValidator() { RuleFor(x => x.UserId) .SetValidator(new PositiveIntegerValidator()) .SetValidator(new UserAccessValidator(session.UserId)); //<-- I need to pass the UserID from the session here } } In the Service Implementation I just do: var session = base.SessionAs<UserSession>(); but this does not work for my abstract validator.

Access SOAP webservice with ServiceStack

大城市里の小女人 提交于 2019-12-01 06:35:05
I'm creating my client/server application intercommunication with ServiceStack, and is working great, but I need also to access an external SOAP web service. I tried to use the Soap12ServiceClient to access it, but I couldn't find any example, and then I went the add service reference WCF way that actually worked, but creating a ton of code. Is it possible to use Soap12ServiceClient in the same easy way I use JsonServiceClient to send a message/request and receive the message/response? If so, can you help or point me to a sample? I'm not sure where you're stuck as all of ServiceStack's C#

ServiceStack.Redis: Unable to Connect: sPort: 0

╄→гoц情女王★ 提交于 2019-12-01 04:35:23
Sometimes (not always) I am getting "Unable to Connect: sPort: 0" error when trying to get value from Redis when using ServiceStack.Redis. Does anyone know what that might mean? I am using PooledRedisClientManager to get the client. I believe you can fix this by increasing the pool's ConnectTimeout . I had it set very low (10ms), so when the pool was created, some of the clients were unable to connect in that short period. If the pool returned one of these clients, it would throw this error (the "0" port is because it's not connected -- it doesn't know what port it's not connected to). After a

Access SOAP webservice with ServiceStack

好久不见. 提交于 2019-12-01 04:27:38
问题 I'm creating my client/server application intercommunication with ServiceStack, and is working great, but I need also to access an external SOAP web service. I tried to use the Soap12ServiceClient to access it, but I couldn't find any example, and then I went the add service reference WCF way that actually worked, but creating a ton of code. Is it possible to use Soap12ServiceClient in the same easy way I use JsonServiceClient to send a message/request and receive the message/response? If so,

Unable to deserialize array

这一生的挚爱 提交于 2019-12-01 04:02:14
Data sent from client will not get deserialized. Client: $.ajax({ type: 'POST', dataType: "json", url: 'savecommentsservice', data: { "Pid": 0, "Comments": [{ "User": "bbbbbb", "Text": "aaaaaaaa" }, { "User": "ddddddd", "Text": "ccccccccc"}] }, DTO: public class Comment { public string User { get; set; } public string Text { get; set; } } public class SaveCommentsRequest { public int Pid { get; set; } public string SiteId { get; set; } public string Column { get; set; } public List<Comment> Comments { get; set; } } Server: Routes.Add<SaveCommentsRequest>("/savecommentsservice"); ... public

ServiceStack NHibernate Session per request

痞子三分冷 提交于 2019-12-01 03:41:21
I am starting to build an app, and I'm planning to use ServiceStack. Just want to know what are the best practices/good approaches for handling NHibernate ISession or, other "per request" context specific session objects. I thought registering a ISessionFactory in the Ioc like: container.Register<ISessionFactory>(sessionFactory); And when needed get a new Session object... Or maybe provide the session object directly: container.Register<ISession>(c => sessionFactory.OpenSession()).ReusedWithin(ReuseScope.None); Or either handle the ISession and a default transaction via the Global.asax

ServiceStack Backbone.Todos Delete 405 not allowed

安稳与你 提交于 2019-12-01 03:16:59
问题 I realized when click Backbone.Todos example "Clear x completed items" I get a DELETE 405 not allowed... I understand from the pervious helps and docs that if I want to enable DELETE PUT PATCH ... I need to set X-http-method-override : DELETE if it was a form or in jquery. But I am not sure how this is done in the Backbone.Todos example as I am new to backbone.js. Could you please point out how to fix the DELETE 405 ? Thank you. EDIT --------------------------------------- I can always change

ServiceStack.Redis: Unable to Connect: sPort: 0

青春壹個敷衍的年華 提交于 2019-12-01 02:16:40
问题 Sometimes (not always) I am getting "Unable to Connect: sPort: 0" error when trying to get value from Redis when using ServiceStack.Redis. Does anyone know what that might mean? I am using PooledRedisClientManager to get the client. 回答1: I believe you can fix this by increasing the pool's ConnectTimeout . I had it set very low (10ms), so when the pool was created, some of the clients were unable to connect in that short period. If the pool returned one of these clients, it would throw this

Unable to deserialize array

ε祈祈猫儿з 提交于 2019-12-01 01:14:20
问题 Data sent from client will not get deserialized. Client: $.ajax({ type: 'POST', dataType: "json", url: 'savecommentsservice', data: { "Pid": 0, "Comments": [{ "User": "bbbbbb", "Text": "aaaaaaaa" }, { "User": "ddddddd", "Text": "ccccccccc"}] }, DTO: public class Comment { public string User { get; set; } public string Text { get; set; } } public class SaveCommentsRequest { public int Pid { get; set; } public string SiteId { get; set; } public string Column { get; set; } public List<Comment>

Doxygen and add a value of an attribute to the output documentation

倖福魔咒の 提交于 2019-12-01 01:00:40
问题 ServiceStack marks rest paths for web services using c# attributes. For example [RestService("/hello1")] [RestService("/hello2")] public class Hello I would like to make Doxygen include values of the RestService attribute in the doxygen output for the Hello class. I'm not concerned too much with pretty formattin if the full line with brackets is included in the output document. Any suggestions? A quick and dirty trick would be a preferable to writing a Doxygen extension ;) Cheers Tymek ===