Closed thedjdoorn closed 1 year ago
Hey @thedjdoorn, I've identified and fix the issue you were facing! One suggestion of your model structure: you don't need to define custom deserializers (ex a constructor with a IDictionary<string, object>
), the driver will automatically create a deserialization strategy for your type, all you need to specify is the properties like so:
public class Company
{
public Guid Id { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public Person[] Employees { get; set; }
// link properties
public LocalDate EmploymentStart { get; set; }
public LocalDate EmploymentEnd { get; set; }
}
Another thing I'd recommend is using a INamingStrategy
to conform to both .NETs and EdgeDBs naming conventions. You can find more about that here https://www.edgedb.com/docs/clients/dotnet/customtypes#using-a-naming-strategy
Let me know if you have any other questions or if you find any other bugs, I'll release this fix momentarily
Describe the bug When the type of two links on the same entity is similar (that is, the two types share field names), the deserializer attempts to create objects of the wrong type for one of them.
Reproduction Project repo that includes schema and data: https://github.com/thedjdoorn/edgedb-demo
If you visit a Person-page (/person/a1fddd58-c18d-11ed-8e59-03e4e3f563dc for instance), and place a breakpoint in both the Interest and Company deserializer, you'll notice that the deserializer for Company is called for data in
Interests
.Expected behavior A Person object with filled Companies and Interests fields is created.
Versions:
edgedb-net
version: 1.1.1Additional context Does the deserializer use the name property passed to the EdgeDBType annotation? Or is that ignored completely?