Skip to content

Commit fd050bd

Browse files
committed
Publish dotnet client on NuGet.org.
1 parent dbd5822 commit fd050bd

File tree

5 files changed

+41
-14
lines changed

5 files changed

+41
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Moreover, client packages and containers are available via:
6363
- [Docker](https://hub.docker.com/r/trailbase/trailbase)
6464
- [JavaScript/Typescript client](https://www.npmjs.com/package/trailbase)
6565
- [Dart/Flutter client](https://pub.dev/packages/trailbase)
66-
- [C#/.Net](https://github.com/trailbaseio/trailbase/tree/main/client/trailbase-dotnet)
66+
- [C#/.Net](https://www.nuget.org/packages/TrailBase/)
6767

6868
## Running
6969

client/trailbase-dotnet/ClientTest.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
using Xunit;
12
using System.Diagnostics;
23

34
namespace TrailBase;
45

56
public static class Constants {
6-
public const int Port = 4007;
7+
public static int Port = 4010 + System.Environment.Version.Major;
78
}
89

910
class SimpleStrict {
@@ -113,9 +114,16 @@ public async Task RecordsTest() {
113114
var api = client.Records("simple_strict_table");
114115

115116
var now = DateTimeOffset.Now.ToUnixTimeSeconds();
117+
118+
// Dotnet runs tests for multiple target framework versions in parallel.
119+
// Each test currently brings up its own server but pointing at the same
120+
// underlying database file. We include the runtime version in the filter
121+
// query to avoid a race between both tests. This feels a bit hacky.
122+
// Ideally, we'd run the tests sequentially or with better isolation :/.
123+
var suffix = $"{now} {System.Environment.Version}";
116124
List<string> messages = [
117-
$"C# client test 0: {now}",
118-
$"C# client test 1: {now}",
125+
$"C# client test 0: {suffix}",
126+
$"C# client test 1: {suffix}",
119127
];
120128

121129
List<RecordId> ids = [];
@@ -136,15 +144,15 @@ public async Task RecordsTest() {
136144
var recordsAsc = await api.List<SimpleStrict>(
137145
null,
138146
["+text_not_null"],
139-
[$"text_not_null[like]=%{now}"]
147+
[$"text_not_null[like]=%{suffix}"]
140148
)!;
141149
Assert.Equal(messages.Count, recordsAsc.Count);
142150
Assert.Equal(messages, recordsAsc.ConvertAll((e) => e.text_not_null));
143151

144152
var recordsDesc = await api.List<SimpleStrict>(
145153
null,
146154
["-text_not_null"],
147-
[$"text_not_null[like]=%{now}"]
155+
[$"text_not_null[like]=%{suffix}"]
148156
)!;
149157
Assert.Equal(messages.Count, recordsDesc.Count);
150158
recordsDesc.Reverse();
@@ -179,7 +187,7 @@ public async Task RecordsTest() {
179187
var records = await api.List<SimpleStrict>(
180188
null,
181189
null,
182-
[$"text_not_null[like]=%{now}"]
190+
[$"text_not_null[like]=%{suffix}"]
183191
)!;
184192

185193
Assert.Single(records);

client/trailbase-dotnet/README.md

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

client/trailbase-dotnet/TrailBase.csproj

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<PackageId>TrailBase</PackageId>
5+
<Version>0.1.1</Version>
6+
<Authors>TrailBase authors</Authors>
7+
<PackageReadmeFile>./README.md</PackageReadmeFile>
8+
<PackageLicenseExpression>OSL-3.0</PackageLicenseExpression>
9+
<PackageProjectUrl>https://trailbase.io</PackageProjectUrl>
10+
<RepositoryUrl>https://github.com/trailbaseio/trailbase</RepositoryUrl>
11+
12+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
13+
14+
<IsPackable>true</IsPackable>
515
<ImplicitUsings>enable</ImplicitUsings>
616
<Nullable>enable</Nullable>
17+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
718
</PropertyGroup>
819

20+
<ItemGroup>
21+
<None Include="README.md" Pack="true" PackagePath="\"/>
22+
</ItemGroup>
23+
924
<ItemGroup>
1025
<PackageReference Include="coverlet.collector" Version="6.0.2">
1126
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -22,8 +37,4 @@
2237
</PackageReference>
2338
</ItemGroup>
2439

25-
<ItemGroup>
26-
<Using Include="Xunit" />
27-
</ItemGroup>
28-
2940
</Project>

docs/src/content/docs/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ import { Duration100kInsertsChart } from "./reference/_benchmarks/benchmarks.tsx
137137
<Image margin={0} class="p-0 m-0" width={42} height={52} src={flutterLogo} alt="Flutter" />
138138
</a>
139139

140-
<span>
140+
<a href="https://www.nuget.org/packages/TrailBase/">
141141
<Image margin={0} class="p-0 m-0" width={52} height={52} src={dotnetLogo} alt="Dotnet" />
142-
</span>
142+
</a>
143143
</div>
144144
</Card>
145145

0 commit comments

Comments
 (0)