Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to use EFCore Scaffold-DbContext using this package #95

Open
RothAndrew opened this issue May 14, 2024 · 1 comment
Open

Ability to use EFCore Scaffold-DbContext using this package #95

RothAndrew opened this issue May 14, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@RothAndrew
Copy link

Feature request

Is your feature request related to a problem? Please describe.

I'd like the ability to use EFCore's Scaffold-DbContext with this package, so that the entities that get created use the right attributes and can be used with the supabase client.

Describe the solution you'd like

A command such as:

dotnet ef dbcontext scaffold --project foo.csproj --startup-project foo.csproj --configuration Debug Host=localhost;Port=5432;Username=supabase_admin;Password=your-super-secret-and-long-postgres-password;Database=postgres Supabase.Postgrest --data-annotations --context MyDbContext --context-dir Context --force --output-dir Entities --schema public

completes successfully, and creates a class for each database table, which use the correct attributes ([Table], [PrimaryKey], [Column], etc)

Actual result:

System.InvalidOperationException: Unable to find expected assembly attribute [DesignTimeProviderServices] in provider assembly 'Supabase.Postgrest'. This attribute is required to identify the class which acts as the design-time service provider factory for the provider.

Describe alternatives you've considered

I can run the scaffold command using the Npgsql.EntityFrameworkCore.PostgreSQL package, and it creates the right classes for me, but they have the wrong attributes and they don't inherit BaseModel, which causes the supabase client to error if you try to use them. I would have to manually edit every class to have the right attributes and inheritance.

Additional context

none

@RothAndrew RothAndrew added the enhancement New feature or request label May 14, 2024
@acupofjose
Copy link
Collaborator

This would be very helpful functionality. It looks like this would require writing an extension to the Npgsql.EntityFrameworkCore.PostgreSQL package and releasing a separate nuget package, wouldn't it? Or am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants