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

v12 - EF Core Alternate Provider Support #14135

Closed
mroberts91 opened this issue Apr 20, 2023 · 4 comments
Closed

v12 - EF Core Alternate Provider Support #14135

mroberts91 opened this issue Apr 20, 2023 · 4 comments
Labels

Comments

@mroberts91
Copy link
Contributor

mroberts91 commented Apr 20, 2023

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

v12/feature/ef-core

Bug summary

As seen in recent commits to the v12/feature/ef-core branch, there was a removal of code from the EF Core Context extension methods that drops support for exposing the DbContextOptionsBuilder, which would allow for the configuration of alternative EF Core Providers by consumers of the library.

We were under the assumption/hoping that the addition of EF Core to the Umbraco Platform would include the ability to use the rich ecosystem of data store providers that EF Core provides. It appears, looking at the current feature, that EF Core will be restricted to Sqlite and SQL Server.

private static void DefaultOptionsAction(DbContextOptionsBuilder options, string? providerName, string? connectionString)
{
    if (connectionString.IsNullOrWhiteSpace())
    {
        return;
    }

    switch (providerName)
    {
        case "Microsoft.Data.Sqlite":
            options.UseSqlite(connectionString);
            break;
        case "Microsoft.Data.SqlClient":
            options.UseSqlServer(connectionString);
            break;
    }
}

Exposing the DbContextOptionsBuilder would allow consumers to not be forced down the path of 2 data store providers as it currently sits with v11 and prior versions.

Our main use case for alternative providers would be using the NPGSQL EF Core Provider.

Can you confirm that the use case of EF Core in Umbraco v12 will be limited to just Sqlite and SQL Server?

Specifics

No response

Steps to reproduce

Commit with the removal of DbContextOptionsBuilder commit

Expected result / actual result

No response

@github-actions
Copy link

Hi there @mroberts91!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@CyberReiter
Copy link
Contributor

I think Umbraco is missing a great opportunity if it is not giving the possibility to add different providers.
While Umbraco should itself only focus on the current 2 providers, the community should have the possibility to create packages offering support for different databases.

@Zeegaan
Copy link
Member

Zeegaan commented Apr 24, 2023

Heyo! 👋 Not sure I'm understanding the use-case here 😁
The extension method you're referring to that uses the DefaultOptionsActions method is the helper method to register your DbContext to use our scopes. The use case here is mainly to extend our database, and Umbraco only supports SQlite & SqlServer.
However, you can still create an entirely separate database, and register it using .AddDbContext<> in the startup.cs file. And here you can use whatever provider you want 👍

@Zeegaan Zeegaan added state/needs-more-info We don't have enough information to give a good reply and removed state/needs-more-info We don't have enough information to give a good reply labels Apr 24, 2023
@Zeegaan
Copy link
Member

Zeegaan commented Apr 25, 2023

I am closing this as hopefully my comment has cleared up any questions! 🙏
Otherwise, any feedback you have are welcome on the PR for this feature: #14109 🚀

@Zeegaan Zeegaan closed this as completed Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants