servicestack

ServiceStack Entities Id field name

穿精又带淫゛_ 提交于 2019-12-05 00:13:18
问题 I use ServiceStack and would like to store objects as hashes in Redis and get an access to their parts (fields) by ids without serializing whole object, so I have a questions: Is there a way to use other property then "Id", to mark id field? I am using naming conventions, where id field is named like "class name+Id". So in User class there will be UserId id field, in Itemclass ItemId and so on. Is the a way to update properties that were changed in the object without serializing whole object

Examine Request Headers with ServiceStack

让人想犯罪 __ 提交于 2019-12-04 22:17:40
问题 What is the best way to inspect the Request Headers for a service endpoint? ContactService : Service Having read this https://github.com/ServiceStack/ServiceStack/wiki/Access-HTTP-specific-features-in-services I'm curious as to the preferred way to get to the Interface. Thank you, Stephen 回答1: Inside a ServiceStack Service you can access the IHttpRequest and IHttpResponse objects with: public class ContactService : Service { public object Get(Contact request) { var headerValue = base.Request

How to perform a more complex query with AutoQuery

守給你的承諾、 提交于 2019-12-04 22:13:23
Given the following definitions from a ServiceStack endpoint: public class LoanQueue { public int LoanId { get; set; } public DateTime Submitted { get; set; } public DateTime Funded { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public int Fico { get; set; } public int Fraud { get; set; } public int CDS { get; set; } public int IDA { get; set; } public string Income { get; set; } public string Liabilities { get; set; } public string Agent { get; set; } public string Status { get; set; } public string State { get; set; } public string Product { get; set

Redis serviceStack pooled connection client

时光毁灭记忆、已成空白 提交于 2019-12-04 18:49:29
问题 I'm designing a web service which uses Redis as a database, and I want to know the best practices for using Redis connecting with StackService client. The point is that I've been reading about Redis and I found that the best way to interact with the server is by using a single concurrent connection. The problem is that despite I'm using PooledRedisClientManager each time that a web client makes a request to the web service I get a one more connected client (opened connection) to the redis

Send a large message to a ServiceStack service

流过昼夜 提交于 2019-12-04 18:44:46
I need to create a service that will allow a client to send a message containing a large amount of data and I'm not sure how to structure the API. Let's say a client wants to save a new object which contains a variable number of related objects. For instance, an Order, which contains several line items contained in OrderDetail objects. An Order may have over a 1000 OrderDetail objects related to it, each of which may contain 20-40KB of data. The client needs to know that the service has received the entire order. I would like to explore using ServiceStack to create this. Creating a high

How to pipeline multiple read commands to Redis using ServiceStack

↘锁芯ラ 提交于 2019-12-04 17:24:02
Using ServiceStack, is there a way to perform multiple read commands (in particular the ContainsKey command)? The objects stored take a while to fetch from the database, so we're looking to get only the ones that are not in cache. I know that I can ask redis for the object and then fetch from the database if it comes back null, but the objects being stored are fairly large, so I'd rather just get a list of bools back and then determine which ids to query in the database from that. For the time being I'm looping through my list of Ids (can be up to 100 or so) and using the ContainsKey method in

ServiceStack Razor - “Forbidden” error for default document

强颜欢笑 提交于 2019-12-04 17:06:34
I am creating a ServiceStack based website using the Razor format engine. In the folder root of my project I have "default.cshtml", but attempting to navigate to the URL (on localhost) I receive a 302 redirect to default.cshtml and the following page: Forbidden Request.HttpMethod: GET Request.PathInfo: /default.cshtml Request.QueryString: Request.RawUrl: /default.cshtml Here is my Global.asax.cs: public class AppHost : AppHostBase { public AppHost() : base("OOMS 2.0", typeof(OOMS.ServiceInterface.OOMSService).Assembly) { } public override void Configure(Container container) { Plugins.Add(new

Translate a List<TypeA> to List<TypeB>

人盡茶涼 提交于 2019-12-04 16:54:32
Understood the concept of translate . Used it in converting a DataModel Type to DTO type for presentation layer like this and worked fine. objTypeB = objTypeA.TranslateTo<clsTypeB>(); Discrepancy between TypeA and TypeB was just the datatype of few properties and I converted them in the Property Set method. But in the above implementation if the source is List<TypeA> , I have loop through each to translate to TypeB and add it another List<TypeB> instance. Is it possible to do something like this instead: Assume resultListA is a List<clsTypeA> var resultListB = resultListA.TranslateTo<List

Separate or combined ServiceStack services?

大城市里の小女人 提交于 2019-12-04 16:28:54
I want to have ServiceStack endpoints such as the following... [RestService("/items/recent")] [RestService("/items/recent/{Page}")] [RestService("/items/popular")] [RestService("/items/popular/{Page}")] Since both would return a List<Item> , I'd love to be able to have both of these in the same RestServiceBase for easier code management. Is this possible? If so, how can I differentiate the request when it comes in to find whether it was a "recent" or "popular" request so that I can handle it appropriately? mythz Yes you can have multiple REST-ful paths pointing to the same web service. If you

Purpose of IReturn and IReturnVoid within JsonServiceClient.Get

人盡茶涼 提交于 2019-12-04 16:28:24
Is there a reason why I need to supply IReturn or IReturnVoid references to ServiceStack's JsonServiceClient.Get? There must be a good reason (I'm quite new to the framework) but I don't understand why I have to convert my objects to IReturn wrappers or make them ServiceStack dependant. I have read those posts but couldn't find the explaination I am looking for (only workarounds): ServiceStack: JsonServiceClient usage without IReturn in DTO ServiceStack IReturn Thanks! JSON is an untyped data format. Well, there are string and numeric, arrays and key/value pairs - that's about it. JSON over