question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support seeding for JSON POCOs

See original GitHub 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.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:9
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
rojicommented, Jan 19, 2021

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…

2reactions
rojicommented, Jan 6, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support seeding for JSON POCOs -
I'm trying to use a POCO mapping (to use a jsonb column with a list of a defined object). When I try to...
Read more >
Parser throws Poco::JSON::JSONEception error
I am trying to parse a JSON object with poco parser. I am running into a Poco::JSON::JSONException at xxx memory location. I don't...
Read more >
Performing seed data to database from JSON using reflection
Seeding with JSON data · Step 1: Add JSON file · Step 2: Update Startup file · Step 3: create the Seeding class....
Read more >
POCO C++ Libraries Release Notes
New JWT library for dealing with JSON Web Tokens. Upgrade bundled SQLite to version 3.31.0. The NetSSL_OpenSSL library supports TLS 1.3 with OpenSSL...
Read more >
EF Core 7: It Just Keeps Getting Better
Because of this, direct support for JSON columns has been a highly requested feature for EF Core. Finally with EF Core 7, it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found