static async Task Main(string[] args) { using (IDgraphClient client = DgraphDotNet.Clients.NewDgraphClient()) { client.Connect("127.0.0.1:9080"); await client.AlterSchema( "Username: string @index(hash) .\n" + "Password: password ."); var schemaResult = await client.SchemaQuery(); if (schemaResult.IsFailed) { Console.WriteLine($"Something went wrong getting schema."); return; } Console.WriteLine("Queried schema and got :"); foreach (var predicate in schemaResult.Value.Schema) { Console.WriteLine(predicate.ToString()); } while (true) { Console.WriteLine("Hi, please enter your new username"); var username = Console.ReadLine(); // use Upsert to test for a node and value, and create if // not already in the graph as an atomic operation. var result = await client.Upsert( "Username", GraphValue.BuildStringValue(username), $"{{\"uid\": \"_:myBlank\", \"Username\": \"{username}\"}}", "myBlank"); if (result.IsFailed) { Console.WriteLine("Something went wrong : " + result); continue; } var(node, existed) = result.Value; if (existed) { Console.WriteLine("This user already existed. Try another username."); continue; } Console.WriteLine("Hi, please enter a password for the new user"); var password = Console.ReadLine(); using (var txn = client.NewTransaction()) { var mutation = txn.NewMutation(); var property = Clients.BuildProperty(node, "Password", GraphValue.BuildPasswordValue(password)); if (property.IsFailed) { // ... something went wrong Console.Write("uhh"); } else { mutation.AddProperty(property.Value); var err = await mutation.Submit(); if (err.IsFailed) { // ... something went wrong Console.Write(err); } } await txn.Commit(); } } } }