https://github.com/geldata/gel-net
The official .NET client library for EdgeDB
https://github.com/geldata/gel-net
cs csharp database dotnet edgedb efcore fs fsharp
Last synced: about 1 month ago
JSON representation
The official .NET client library for EdgeDB
- Host: GitHub
- URL: https://github.com/geldata/gel-net
- Owner: edgedb
- License: apache-2.0
- Created: 2022-09-23T16:24:49.000Z (over 2 years ago)
- Default Branch: dev
- Last Pushed: 2024-06-05T15:27:13.000Z (12 months ago)
- Last Synced: 2024-09-18T10:53:26.433Z (9 months ago)
- Topics: cs, csharp, database, dotnet, edgedb, efcore, fs, fsharp
- Language: C#
- Homepage: https://edgedb.com
- Size: 2.46 MB
- Stars: 83
- Watchers: 7
- Forks: 9
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README

Gel.Net is the official .NET driver for the Gel database.
## Installation
Gel.Net is distributed through the NuGet package manager.
We recommend using the `dotnet` command or NuGet package manager in Visual
Studio:```bash
$ dotnet add package Gel.Net.Driver
```## Basic usage
### Creating a client
Clients are what allow your code to talk and interface with Gel. The
`GelClientPool` class contains a pool of connections and numerous abstractions
for executing queries with ease:```cs
using Gel;var client = new GelClientPool();
```### Client configuration
`GelClientPool` will automatically determine how to connect to your Gel
instance by resolving [Gel Projects](https://docs.geldata.com/learn/projects).
For specifying custom connection arguments, considering checking out the
`GelConnection` class. Here's an example of using the `.Create()` method:```cs
using Gel;var connection = GelConnection.Create(
new GelConnection.Options(){dsn="gel://user:password@localhost:5656/mybranch"}
);
var client = new GelClientPool(connection);
```### Executing queries
**Note**: Gel.Net is a fully asynchronous driver, and as such, all I/O
operations are performed asynchronously.Queries are executed through the `GelClientPool` by using different helper
methods. Your choice of method is dependent on the kind of query you're making,
better known as [cardinality](https://docs.geldata.com/reference/edgeql/sets#everything-is-a-set).Query helper methods will expect a generic `T` type which is the .NET version
of an Gel type:```cs
var result = await client.QueryAsync("select 2 + 2"); // returns 4
```## Contributing
We openly welcome and accept contributions to Gel.Net! Before writing a
GitHub Issue or Pull Request, please see our [contribution requirements](CONTRIBUTING.md).## Examples
This repository contains a list of [working examples](examples),
check them out to see Gel.Net in action!## Compiling
If you're building Gel.Net from source, you will need to download the
[.NET 8 SDK](https://dotnet.microsoft.com/en-us/download).Once you have the SDK installed, you can then run `dotnet build` in the root
directory of the project:```bash
$ dotnet build
```## Testing
You can run the test suite by using `dotnet test` like so:
```bash
$ dotnet test
```