Closed SilvieM closed 1 month ago
@SilvieM Are you maybe accidentally using a duplicated field for the State
property up above? That's the most likely explanation. That exact use case is pretty well covered today in the Marten LINQ tests
Ooof. How embarassing. Yes I am. I wasnt aware that fields can be duplicated that way and never scrolled all the way to the right in the db. Thanks for the help.
Hello, I came across an issue with LINQ serialization. I'm trying to strip it down to only the involved parts. My classes are:
Now when I request entries of Thing that have a certain state, I should be able to do:
var revokedThings = querySession.Query<Thing>().Where(it => it.State == ThingState.Revoked).ToList();
But it serializes this to
And that returns empty, because the data column contains json. It doesnt even give me an error, just an empty list. A working query would go:
select d.data from public.mt_doc_thing as d where data ->> 'State' = 'Revoked';
Requesting all with .toList() and then adding the Where afterwards so it is evaluated locally works fine and gives me results.
We have some custom serializer settings
Relevant Versions: .NET 8.0 Marten 6.4.1 Newtonsoft.Json 13.0.3 NPGSQL.Json.NET 7.0.6