Skip to content
This repository was archived by the owner on Oct 6, 2022. It is now read-only.

Conversation

@quinchs
Copy link
Owner

@quinchs quinchs commented Sep 12, 2022

Summary

This PR contains modifications to the dotnet driver API to standardize it with other drivers and changes related to feedback provided by the EdgeDB team.

Changes

State (config, aliases, module, globals)

The state API has changed to follow the other drivers (js/ts, python, go, rust) and is defined like so:

var baseClient = new EdgeDBClient();
var client = baseClient
    .WithConfig(conf => conf.AllowDMLInFunctions = true)
    .WithGlobals(new Dictionary<string, object?>
    {
        { "current_user_id", Guid.NewGuid() }
    });

There are now 4 methods exposed on EdgeDBClient called WithConfig, WithGlobals, WithModule, and WithAliases which will return a new EdgeDBClient that shares the same client pool as its parent (baseClient in this example)1.

Object Deserialization

The deserialization step has been optimized to remove the intermediate dynamic object in favor for a ObjectEnumerator type which acts like an IEnumerator. The new method is designed to be fast and play well with the current binary workflow.

Benchmarks

Deserializing the type Person

public class Person
{
    public string? Name { get; set; }

    public string? Email { get; set; }
}
Method Mean Error StdDev Gen 0 Allocated
DeserializePersonOld 1.645 us 0.0311 us 0.0291 us 0.1259 792 B
DeserializePersonNew 487.8 ns 5.28 ns 4.94 ns 0.0505 320 B

TODO's


Node
The official release is just for the EdgeDB.Net.Driver package, the query builder is still in development

Footnotes

  1. see the js implementation.

@quinchs quinchs force-pushed the future/official-client-release branch from 03b7612 to 5999a18 Compare September 14, 2022 15:47
@quinchs quinchs marked this pull request as ready for review September 20, 2022 13:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants