mirror of
https://github.com/trailbaseio/trailbase.git
synced 2025-12-19 16:39:59 -06:00
Publish dotnet client on NuGet.org.
This commit is contained in:
@@ -63,7 +63,7 @@ Moreover, client packages and containers are available via:
|
||||
- [Docker](https://hub.docker.com/r/trailbase/trailbase)
|
||||
- [JavaScript/Typescript client](https://www.npmjs.com/package/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
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using Xunit;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace TrailBase;
|
||||
|
||||
public static class Constants {
|
||||
public const int Port = 4007;
|
||||
public static int Port = 4010 + System.Environment.Version.Major;
|
||||
}
|
||||
|
||||
class SimpleStrict {
|
||||
@@ -113,9 +114,16 @@ public class ClientTest : IClassFixture<ClientTestFixture> {
|
||||
var api = client.Records("simple_strict_table");
|
||||
|
||||
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 = [
|
||||
$"C# client test 0: {now}",
|
||||
$"C# client test 1: {now}",
|
||||
$"C# client test 0: {suffix}",
|
||||
$"C# client test 1: {suffix}",
|
||||
];
|
||||
|
||||
List<RecordId> ids = [];
|
||||
@@ -136,7 +144,7 @@ public class ClientTest : IClassFixture<ClientTestFixture> {
|
||||
var recordsAsc = await api.List<SimpleStrict>(
|
||||
null,
|
||||
["+text_not_null"],
|
||||
[$"text_not_null[like]=%{now}"]
|
||||
[$"text_not_null[like]=%{suffix}"]
|
||||
)!;
|
||||
Assert.Equal(messages.Count, recordsAsc.Count);
|
||||
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>(
|
||||
null,
|
||||
["-text_not_null"],
|
||||
[$"text_not_null[like]=%{now}"]
|
||||
[$"text_not_null[like]=%{suffix}"]
|
||||
)!;
|
||||
Assert.Equal(messages.Count, recordsDesc.Count);
|
||||
recordsDesc.Reverse();
|
||||
@@ -179,7 +187,7 @@ public class ClientTest : IClassFixture<ClientTestFixture> {
|
||||
var records = await api.List<SimpleStrict>(
|
||||
null,
|
||||
null,
|
||||
[$"text_not_null[like]=%{now}"]
|
||||
[$"text_not_null[like]=%{suffix}"]
|
||||
)!;
|
||||
|
||||
Assert.Single(records);
|
||||
|
||||
8
client/trailbase-dotnet/README.md
Normal file
8
client/trailbase-dotnet/README.md
Normal 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).
|
||||
@@ -1,11 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<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>
|
||||
<Nullable>enable</Nullable>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath="\"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.2">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
@@ -22,8 +37,4 @@
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -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" />
|
||||
</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" />
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user