Closed mrinc closed 8 years ago
Hi @mrinc ,
Thanks for bringing this up.
I just want to confirmid
is Guid.Empty
because [JsonIgnore]
is ignoring the field during _desalinization_ correct? I think DataExplroer should show the User
with a non-empty GUID right?
So, I think the proper attribute for Id
something like this:
public class User
{
[JsonProperty("id", DefaultValueHandling = DefaultValueHandling.Ignore)]
public Guid Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
The id
field is excluded during serialization on the way out, id
is populated by RethinkDB on insert. Then, during deserialization on the way in, the id
value is a non-empty GUID and populated.
This is probably what needs to be documented right?
Hi @mrinc ,
I've added some more explicit documentation regarding POCO primary keys.
https://github.com/bchavez/RethinkDb.Driver/wiki/Extra-C%23-Driver-Features#poco-primary-keys
I hope this helps!
Thanks, Brian
Hello,
I'm not sure you could call this an issue on your side but I wanted to state it so if it's something to keep note of, we could add it to the wiki.
If you create class and set a property as a JsonIgnore property, it does not get set when you select from the DB.
Class:
Select:
Result:
Thanks :+1: