GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - AnthonyCarl/ServiceStack.PartialResponse: Google Style Partial Responses for ServiceStack.Net

BranchesTags
Open more actions menu

Latest commit

 

History

57 Commits
57 Commits

Folders and files

NameName
Last commit message
Last commit date
src/ServiceModel
src/ServiceModel
 
 
tools
tools
 
 
LICENSE
LICENSE
 
 
LICENSE_ServiceStack
LICENSE_ServiceStack
 
 
MajorMinorVersion.txt
MajorMinorVersion.txt
 
 
README.md
README.md
 
 
ReleaseNotes.md
ReleaseNotes.md
 
 
build.bat
build.bat
 
 
default.ps1
default.ps1
 
 

Repository files navigation

ServiceStack.PartialResponse.ServiceModel

Google Style Partial Responses for ServiceStack.Net. Currently only the following Content types are supported:

  • application/json
  • application/jsv
  • text/html

application/xml is NOT currently supported.

This is implemented as an IRequestContext extension. It can easily be incorporated into a ServiceStack plugin as part of the final processing of your response.

##Providing Field Selectors Field Selectors can be passed using the header or query string. By default field selectors are combined form both. Duplicate field selectors are reduced. The field selector is applied to all entries in a list if the selector refers to a list.

Method Example
Query String http://myhost/mydtoroute?fields=id&fields=todt or http://myhost/mydtoroute?fields=id,todt
Header x-fields: id,todt

If field selectors are passed in the query string, make sure it is properly encoded.

##Field Selector Reserved Characters

Character Meaning
, Separates multiple field selectors
/ Field sub selector
( Begin subselection expression
) End subselection expression

Currently * is not supported.

Note: All field selector reserved characters may be nested.

##Field Selector Examples

Example: person(name(first,last),address(zip,street)),person/salary,link(url,description/short)

Explanation: This will select the person's first and last name, their salary, and the zip and street portions of their address. It will also select the url and short description of the link.


Example: people/name/first

Explanation: people refers to a list. This will select the first name of all people in the list.

##Code Examples

public object Get(MyRequestDto request)
{
  MyResponseDto response = SomeMethodThatGeneratesTheResponse(request);
  return base.requestContext.ToPartialResponse(response)
}

--or, if you want it compressed--

public object Get(MyRequestDto request)
{
  MyResponseDto response = SomeMethodThatGeneratesTheResponse(request);
  return base.ToOptimizedResult(base.requestContext.ToPartialResponse(response))
}

##Basic Benchmark

The DTO used contains 32 properties. The response is a list of 250 of these DTOs. The partial response only selects one integer property.

===================================
Completed 1000 Test Iterations
===================================

===================================
Partial Response min/max/avg 12ms/323ms/15.208ms
===================================
Full Response min/max/avg 18ms/383ms/25.624ms
===================================

##Using the Code

  • Install the NuGet Package
  • NuGet Packages from Latest Successful Build
  • You can check out the code and run build.bat.
    • It will create NuGet packages you can consume in .\ReleasePackages or you can directly use the resulting binaries.
    • If you use a custom made NuGet package and have an internal symbol server, you may be interested in the IndexSrc build target to properly index the source code back to GitHub.
  • Build requirements
    • .Net 4.0
    • Powershell 2.0

##ToDo

  • Publish Code for Client Side support. I have working strongly typed implementation (using expression trees) but it needs to be cleaned up for release.

##Release Notes CodeBetter CI

Special Thanks to JetBrains and CodeBetter for hosting this project!

About

Google Style Partial Responses for ServiceStack.Net

Resources

Readme
BSD-2-Clause license
Activity

Stars

19 stars

Watchers

6 watching

Forks

7 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.