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.

Add PostgreSQL enums support to scaffolding

See original GitHub issue

At least two things needed for it:

  • generation of C# enums for enum types
  • generation of DataType.Enum in mappings

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ademchenkocommented, Nov 21, 2022

Will add to next release. Could you provide more details what code you want to get generated?

So:

  1. I would like to have the ability to generate the enum itself, but also to leave the ability to set up the own enum without the generation (like it’s made previously)
  2. Mappings should be correctly set with NpgsqlDataSource (see the previous answer)

To recap: Suppose I have a postgres enum type a_db. There should be the ability to generate C# enum A_gen by the values of a_db. But, also, if a developer wants they should have the ability to map their own C# enum A_dev to database enum a_db and don’t get A_gen generated (turn off the particular enum generation).

0reactions
ademchenkocommented, Nov 21, 2022

@MaceWindu , mappings in npgsql version are configured with their new NpgsqlDataSource . They described the logic of their movement to the data source approach in the release notes. Could you tell if you have already moved your mapping code base to their data source?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Entity framework Core - Scaffolding enum
PostgreSQL and MySQL have a string enum type. NpgSQL supports them but scaffolding seems to be tricky. The mappings will be generated but...
Read more >
Enum Type Mapping
If you're creating your model from an existing database, the provider will recognize enums in your database, and scaffold the appropriate HasPostgresEnum() ...
Read more >
Documentation: 15: 8.7. Enumerated Types
Enumerated (enum) types are data types that comprise a static, ordered set of values. They are equivalent to the enum types supported in...
Read more >
How to use Enums when using Entity Framework Core with ...
It's pretty simple — we inherit from DbContext (from the Microsoft.EntityFrameworkCore namespace), and add a DbSet property for each entity we' ...
Read more >
Documentation: 15: 9.10. Enum Support Functions
Returns the range between the two given enum values, as an ordered array. The values must be from the same enum type. If...
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