Publish dotnet client on NuGet.org.

This commit is contained in:
Sebastian Jeltsch
2024-11-19 22:25:29 +01:00
parent dbd582275e
commit fd050bd719
5 changed files with 41 additions and 14 deletions

View File

@@ -63,7 +63,7 @@ Moreover, client packages and containers are available via:
- [Docker](https://hub.docker.com/r/trailbase/trailbase) - [Docker](https://hub.docker.com/r/trailbase/trailbase)
- [JavaScript/Typescript client](https://www.npmjs.com/package/trailbase) - [JavaScript/Typescript client](https://www.npmjs.com/package/trailbase)
- [Dart/Flutter client](https://pub.dev/packages/trailbase) - [Dart/Flutter client](https://pub.dev/packages/trailbase)
- [C#/.Net](https://github.com/trailbaseio/trailbase/tree/main/client/trailbase-dotnet) - [C#/.Net](https://www.nuget.org/packages/TrailBase/)
## Running ## Running

View File

@@ -1,9 +1,10 @@
using Xunit;
using System.Diagnostics; using System.Diagnostics;
namespace TrailBase; namespace TrailBase;
public static class Constants { public static class Constants {
public const int Port = 4007; public static int Port = 4010 + System.Environment.Version.Major;
} }
class SimpleStrict { class SimpleStrict {
@@ -113,9 +114,16 @@ public class ClientTest : IClassFixture<ClientTestFixture> {
var api = client.Records("simple_strict_table"); var api = client.Records("simple_strict_table");
var now = DateTimeOffset.Now.ToUnixTimeSeconds(); var now = DateTimeOffset.Now.ToUnixTimeSeconds();
// Dotnet runs tests for multiple target framework versions in parallel.
// Each test currently brings up its own server but pointing at the same
// underlying database file. We include the runtime version in the filter
// query to avoid a race between both tests. This feels a bit hacky.
// Ideally, we'd run the tests sequentially or with better isolation :/.
var suffix = $"{now} {System.Environment.Version}";
List<string> messages = [ List<string> messages = [
$"C# client test 0: {now}", $"C# client test 0: {suffix}",
$"C# client test 1: {now}", $"C# client test 1: {suffix}",
]; ];
List<RecordId> ids = []; List<RecordId> ids = [];
@@ -136,7 +144,7 @@ public class ClientTest : IClassFixture<ClientTestFixture> {
var recordsAsc = await api.List<SimpleStrict>( var recordsAsc = await api.List<SimpleStrict>(
null, null,
["+text_not_null"], ["+text_not_null"],
[$"text_not_null[like]=%{now}"] [$"text_not_null[like]=%{suffix}"]
)!; )!;
Assert.Equal(messages.Count, recordsAsc.Count); Assert.Equal(messages.Count, recordsAsc.Count);
Assert.Equal(messages, recordsAsc.ConvertAll((e) => e.text_not_null)); Assert.Equal(messages, recordsAsc.ConvertAll((e) => e.text_not_null));
@@ -144,7 +152,7 @@ public class ClientTest : IClassFixture<ClientTestFixture> {
var recordsDesc = await api.List<SimpleStrict>( var recordsDesc = await api.List<SimpleStrict>(
null, null,
["-text_not_null"], ["-text_not_null"],
[$"text_not_null[like]=%{now}"] [$"text_not_null[like]=%{suffix}"]
)!; )!;
Assert.Equal(messages.Count, recordsDesc.Count); Assert.Equal(messages.Count, recordsDesc.Count);
recordsDesc.Reverse(); recordsDesc.Reverse();
@@ -179,7 +187,7 @@ public class ClientTest : IClassFixture<ClientTestFixture> {
var records = await api.List<SimpleStrict>( var records = await api.List<SimpleStrict>(
null, null,
null, null,
[$"text_not_null[like]=%{now}"] [$"text_not_null[like]=%{suffix}"]
)!; )!;
Assert.Single(records); Assert.Single(records);

View File

@@ -0,0 +1,8 @@
# TrailBase client library for .NET and MAUI
TrailBase is a [blazingly](https://trailbase.io/reference/benchmarks/) fast,
single-file, open-source application server with type-safe APIs, built-in
JS/ES6/TS Runtime, Auth, and Admin UI built on Rust+SQLite+V8.
For more context, documentation, and an online demo, check out our website
[trailbase.io](https://trailbase.io).

View File

@@ -1,11 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <PackageId>TrailBase</PackageId>
<Version>0.1.1</Version>
<Authors>TrailBase authors</Authors>
<PackageReadmeFile>./README.md</PackageReadmeFile>
<PackageLicenseExpression>OSL-3.0</PackageLicenseExpression>
<PackageProjectUrl>https://trailbase.io</PackageProjectUrl>
<RepositoryUrl>https://github.com/trailbaseio/trailbase</RepositoryUrl>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<IsPackable>true</IsPackable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\"/>
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2"> <PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -22,8 +37,4 @@
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>
</Project> </Project>

View File

@@ -137,9 +137,9 @@ import { Duration100kInsertsChart } from "./reference/_benchmarks/benchmarks.tsx
<Image margin={0} class="p-0 m-0" width={42} height={52} src={flutterLogo} alt="Flutter" /> <Image margin={0} class="p-0 m-0" width={42} height={52} src={flutterLogo} alt="Flutter" />
</a> </a>
<span> <a href="https://www.nuget.org/packages/TrailBase/">
<Image margin={0} class="p-0 m-0" width={52} height={52} src={dotnetLogo} alt="Dotnet" /> <Image margin={0} class="p-0 m-0" width={52} height={52} src={dotnetLogo} alt="Dotnet" />
</span> </a>
</div> </div>
</Card> </Card>