Open mhosman opened 3 years ago
Can you confirm that you're hitting this when trying to add a migration which seeds JSONB List values?
@roji Not necessarily. In the code I attached there is exactly the same example from the documentation (it doesn't use a list, it uses the Customer object). In order to reproduce just open the code, run a migration and you'll get the error. If you remove the HasData part (this will not seed data), the code will work.
Hi, I have this problem too, any fix or workaround?
This is currently unsupported; if you use JSON POCO mapping, you'll have to take care of seeding yourself.
The type mapping could use reflection to discover public properties which are readable and writable, and generate the proper C# code based on that. This will probably require some additions to code generation on the EF Core upstream side.
Hey @roji thank you very much for you response. Is there any idea if this will be implemented in the future? Thank you
As this may go well together with the general push for JSON support in EF Core, I've put this in the 6.0 milestone - but I wouldn't say this is the highest-priority item...
Encountered the problem, hoping to have this feature~
Would be nice if this was bumped up in the list. I was able to find a sneaky away to get around flat jsonb objects but it seems like actual jsonb arrays still has an issue.
I'm trying to use a POCO mapping (to use a jsonb column with a list of a defined object). When I try to run a migration I get an error:
Cannot scaffold C# literals of type 'System.Collections.Generic.List`1[Api.Models.UserType]'. The provider should implement CoreTypeMapping.GenerateCodeLiteral to support using it at design time.
Small project to reproduce the issue: WebApplication2.zip
The only way I've found to achieve this is to create a String and make the JsonSerializer.Serialize() by myself wich is not the best solution at all.