Skip to content

Improve documentation on how to write an EF Core provider  #681

Closed

Description

@divega

Currently we have something very brief at https://docs.microsoft.com/ef/core/providers/writing-a-provider pointing to @ajcvickers's blog.

It would be good to update this to cover:

Whether this should be in a blog post or if it needs to be part of the documentation is something we can discuss, but I would be inclined to have it in the actual documentation.

Activity

  1. self-assigned this
    on Apr 24, 2018
  2. added this to the 2.1.0 milestone on Apr 24, 2018
  3. modified the milestones: 2.1.0, 2.2.0 on Jul 10, 2018
  4. added
    help wanted
    on Feb 21, 2019
  5. modified the milestones: 2.2.0, 3.0.0 on Feb 21, 2019
  6. added and removed
    help wanted
    on Aug 28, 2019
  7. modified the milestones: 3.0.0, Backlog on Aug 28, 2019
  8. modified the milestones: Backlog, 3.1.0 on Sep 6, 2019
  9. 44 remaining items

  10. mguinness commented on Feb 6, 2023

    @mguinness
    Contributor

    You could also take a look at FileBaseContext which is probably one of the simpler providers out there. Maybe @dualbios can provide some tips on creating a provider from scratch.

  11. roji commented on Feb 12, 2023

    @roji
    Member

    @DaveRMaltby I'm not quite sure what you mean with "may allow most of the specific database logic for anyone who needs to create an EF Core provider to be placed in their own ADO.NET data provider and then use this template repo to get most of the way there very quickly"; there's typically various database-specific logic that has to go into each EF provider, which does not belong in the lower-level ADO.NET provider (e.g. how to produce various SQL constructs). The idea of "general ADO.NET-compatible EF provider" which would somehow just work with any ADO.NET provider simply doesn't work.

    I think the main value in a template here would be to have a minimal provider sample which implements the services that must be overridden (or would typically be overridden for most providers). This would only provide a starting point for new providers, or for understanding how a provider looks like.

    Note also that a minimal relational (ADO.NET-based) EF provider looks very different from a non-relational provider; for example, a relational EF provider typically needs to have its version of QuerySqlGenerator, which non-relational provider obviously don't need. I agree it's worth concentrating on a relational template; non-relational providers in general can be extremely different based on the database being targeted, and there's not likely to be a lot of commonality there.

  12. DaveRMaltby commented on May 9, 2023

    @DaveRMaltby

    @roji and @ErikEJ, I didn't forget about this. I have finally completed what I was referring to above. I have taken and built a custom EF Core provider that depends on a SQLite ADO.NET provider. Of course, I knew that there would be some custom code that is unique to support the SQLite provider, but it doesn't seem that much as you can see in MyCustom EF Core provider repo.
    See what yáll think. Look at the README for this repo. I've tried to logically break up what is needed into 4 steps. The basic unit tests are passing for me.
    Note: It builds against EF Core 6.x, but I only did that because currently my product is using that version. If/when you want to add this into an EF Core repo, of course we'll rev it up to the latest version.
    Anyhow, let me know if you want more of my involvement here. For my company's use, I have 4 providers to implement and will be working on those efforts, unless you need something further here. Thanks for the guidance!

  13. JohnGoldInc commented on May 13, 2023

    @JohnGoldInc

    So is it a correct statement that the critical part is working outwards from the ...ServiceCollectionExtensions classes' "IServiceCollection AddEntityFramework..." section, and create your versions of those classes listed there as needed? And that InMemoryServiceCollectionExtensions.cs or CosmosServiceCollectionExtensions.cs is the version probably close to the minimum needed to implement?

  14. DaveRMaltby commented on May 13, 2023

    @DaveRMaltby

    So is it a correct statement that the critical part is working outwards from the ...ServiceCollectionExtensions classes' "IServiceCollection AddEntityFramework..." section, and create your versions of those classes listed there as needed? And that InMemoryServiceCollectionExtensions.cs or CosmosServiceCollectionExtensions.cs is the version probably close to the minimum needed to implement?

    Honestly, I'm still not an expert and got a lot of guidance from ChatGPT. I asked it to indicate the minimal classes required. Anyhow, the ServiceCollectionExtensions class does register your provider services that the Entity Framework will use via DI for itself. It is only your DbContext derived classes (BloggingContext in my unit tests) that end up kicking off the framework to do things using your provider registered services. Anyhow, this was the minimal classes that I found was need to get the GettingStartedTests running with the SQLite in-memory ADO.NET provider. Note: This hasn't been reviewed by @roji and @ErikEJ as far as know, so this example may be missing things.

  15. removed their assignment
    on Aug 31, 2024
  16. ThaDaVos commented on Jul 11, 2026

    @ThaDaVos

    So any idea when the docs get updated?

  17. removed this from the 7.0.0 milestone on Jul 12, 2026
  18. roji commented on Jul 12, 2026

    @roji
    Member

    I'd highly recommend using AI to explore things rather than waiting for documentation on this topic.

  19. ThaDaVos commented on Jul 12, 2026

    @ThaDaVos

    Maybe you should use AI to fix the docs then...

  20. added this to the Backlog milestone on Jul 31, 2026
  21. anasik commented on Aug 15, 2026

    @anasik
    Contributor

    I wrote a successor to @ajcvickers original post that's featured in the docs and I would like it to be featured the same way.

    Here it is: https://anasismail.com/so-you-still-want-to-write-an-ef-core-provider/

    Let me know if I am allowed to make a PR with this?

    @AndriySvyryd

  22. AndriySvyryd commented on Aug 17, 2026

    @AndriySvyryd
    Member

    @anasik Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions