cancel
Showing results forΒ 
Search instead forΒ 
Did you mean:Β 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

.NET Graph Client CRUD Help

dellams
Node

Hi Tribe,

I am trying to get this Cypher query to work in the .net GraphClient but I am getting back the error: "Input string was not in a correct format"

Avatar avatar =
GraphClient.Cypher.Match("(p:Avatar {Username: {nameParam}})") //TODO: Need to add password to match query...
.WithParam("nameParam", username)
.Return(p => p.As())
.ResultsAsync.Result.Single();

Any ideas? πŸ™‚

I also have this for the Save method for creating or updating, it runs the create code with no errors but nothing is added to the DB?

public override IAvatar SaveAvatar(IAvatar avatar)
{
if (avatar.Id == Guid.Empty)
{
avatar.Id = Guid.NewGuid();

            //_graphClient.Cypher
            //    .Unwind(persons, "person")
            //    .Merge("(p:Person { Id: person.Id })")
            //    .OnCreate()
            //    .Set("p = person")
            //    .ExecuteWithoutResults();

            GraphClient.Cypher
               .Merge("(a:Avatar { Id: avatar.Id })") //Only create if doesn't alreadye exists.
               .OnCreate()
               .Set("a = avatar") //Once created, set the properties.
               .ExecuteWithoutResultsAsync();
        }
        else
        {
            GraphClient.Cypher
               .Match("(a:Avatar)")
               .Where((Avatar a) => a.Id == avatar.Id)
               .Set("a = avatar") //Set the properties.
               .ExecuteWithoutResultsAsync();
        }

        return avatar;
    }

Any ideas? I'm a noob so any help would be really appreciated thanks!

Cheers
D.

1 REPLY 1

dellams
Node

Anyone? Thanks.