coronabytes / dotnet-arangodb

.NET Driver for ArangoDB
Apache License 2.0
67 stars 18 forks source link

Null Pointer when updating a DB Entry with LINQ #44

Closed Snotax closed 2 years ago

Snotax commented 2 years ago

I have another problem with my LINQ queries. I'm not sure what it is, probably a missuse on my side.

Can somebody explain to me how to update only certain values on a document ?

 var result = await _dbContext.QueryLinq<Tenant>("gt", "env").Where(t => t.Key == key).Update(x => new
            {
                Name = x.Name,
                ShortForm = x.ShortForm,
                Disabled = x.Disabled,
                PrimaryColor = primaryColor,
                SecondaryColor = secondaryColor,
                BaseUrl = baseUrl,
                AvailableRegions = availableRegions.ToList(),
                AvailableFeatures = availableFeatures.ToList(),
                Logo = logo.Length > 0 ? logo : x.Logo,
                Key = key
            }, x => x.Key).ToListAsync();

As soon as I try to access "x", I get a NULLPOINTER exception, and when I dont set those values, they will all get overwritten with NULL.

Thanks in advance!