Skip to content

Instantly share code, notes, and snippets.

@gistlyn
Created April 15, 2021 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gistlyn/d3a0dfcd0851d928badad66b90affc06 to your computer and use it in GitHub Desktop.
Save gistlyn/d3a0dfcd0851d928badad66b90affc06 to your computer and use it in GitHub Desktop.
Chinook Query Artists Example
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ServiceStack.Client" Version="5.*" />
<PackageReference Include="ServiceStack.Common" Version="5.*" />
</ItemGroup>
</Project>
/* Options:
Date: 2021-04-14 07:49:13
Version: 5.105
Tip: To override a DTO option, remove "//" prefix before updating
BaseUrl: https://chinook.netcore.io
GlobalNamespace: ChinookQueryArtists
//MakePartial: True
//MakeVirtual: True
//MakeInternal: False
//MakeDataContractsExtensible: False
//AddReturnMarker: True
//AddDescriptionAsComments: True
//AddDataContractAttributes: False
//AddIndexesToDataMembers: False
//AddGeneratedCodeAttributes: False
//AddResponseStatus: False
//AddImplicitVersion:
//InitializeCollections: True
//ExportValueTypes: False
IncludeTypes: QueryArtists.*
//ExcludeTypes:
//AddNamespaces:
//AddDefaultXmlNamespace: http://schemas.servicestack.net/types
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using ChinookQueryArtists;
namespace ChinookQueryArtists
{
[Route("/artists", "GET")]
[Route("/artists/{ArtistId}", "GET")]
public partial class QueryArtists
: QueryDb<Artists>, IReturn<QueryResponse<Artists>>, IGet
{
public QueryArtists()
{
ArtistIdBetween = new long[]{};
}
public virtual long? ArtistId { get; set; }
public virtual long[] ArtistIdBetween { get; set; }
public virtual string NameStartsWith { get; set; }
}
public partial class Artists
{
public virtual long ArtistId { get; set; }
public virtual string Name { get; set; }
}
}
using System;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
using ChinookQueryArtists;
var client = new JsonServiceClient("https://chinook.netcore.io");
var response = client.Send(new QueryArtists {
ArtistIdBetween = new[] { 1L, 100L },
NameStartsWith = "F",
});
response.PrintDump();
Inspect.vars(new { response });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment