You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a schemafull table with an optional field (option) and mapped a C# object to it. But when I try to insert new records using Upsert or Create, if the value is null, the process fails! It doesn't provide any useful information other that throwing a 'SurrealDb.Net.Exceptions.SurrealDbErrorResultException' , but it might be because surrealdb expects 'NONE' for empty fields and the .NET SDK tries to send 'NULL' instead,
The text was updated successfully, but these errors were encountered:
You are correct. Default value for class objects are null which is different than NONE in the SurrealDB world. You can use the [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] or [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] attribute on your properties so that it will never be in the JSON payload, then being treated as NONE.
I suppose the only missing part would be to force to NONE on merge/patch method. I have plan to add custom attributes to handle the different use cases (also being agnostic to the serialization format). Custom attributes could have the form of:
I have created a schemafull table with an optional field (option) and mapped a C# object to it. But when I try to insert new records using Upsert or Create, if the value is null, the process fails! It doesn't provide any useful information other that throwing a 'SurrealDb.Net.Exceptions.SurrealDbErrorResultException' , but it might be because surrealdb expects 'NONE' for empty fields and the .NET SDK tries to send 'NULL' instead,
The text was updated successfully, but these errors were encountered: