Closed farost closed 3 months ago
Do not edit the content of this comment. The PR reviewer should simply update this comment by ticking each review item below, as they get completed.
Trivial Change
Code
Architecture
The original PR is here. The current PR tries to remerge the changes by squashing.
Re-merged after previous merge didn't do a squash-merge :)
Usage and product changes
We introduce the C# driver for TypeDB. It is built using the cross-platform .NET 6 framework.
Usage: Deployment and usage examples will be provided in a separate pull request. Current state of the code lets you compiling the driver + writing and running behaviour and integration tests for it. The driver is expected to be a Nuget package, which could be added as a dependency to a project and referenced via "using" statements inside the users' code for all platforms.
Architecture: The C# driver is a thin wrapper around the TypeDB Rust driver, introducing classes for a more intuitive interface. Mostly each C# object holds a reference to the corresponding native Rust object, using an FFI (SWIG for C#) for the native object wrappers generation and resource management.
Any error encountered will throw a
TypeDBDriverException
. Note that methods which return anIEnumerable
or a Promise and encounter a server-side error will only throw when the return objects are evaluated (e.g. iterate over or call aLinq
method for anIEnumerable
and callResolve()
for aPromise
).A simple usage example:
Implementation
Driver: Introduces the C# driver, wrapping the C-native classes produced by Rust driver using SWIG. The driver aims to provide a familiar interface for C# developers, hiding data transformations and native calls under the hood. The code's architecture and build flow follow the one from Java with small C#-specific alterations.
Tests: Integration tests use NUnit framework as a built-in framework for C# bazel test rules (more to come in another PR). Behaviour tests use Xunit.Gherkin.Quick framework and are implemented using partial classes for flexible construction of tests based on different sets of step declaration files.
Build: To fetch nuget packages, we use Paket and reference this dependencies in a regular Bazel way (example from the official Bazel repo for C# rules).