Skip to content

How to implement multiple DbContext in same/share extension? #190

Open

Description

@Blue-Nitro
  1. How to use multiple DbContext, when inject IStorage it can auto resolve?
  2. Can I use EF migration command on difference context (1.)?

Activity

  1. DmitrySikorsky commented on Aug 16, 2021

    @DmitrySikorsky
    Member

    Hello.

    1. You need to implement IStorage in your own way and add logic which returns a correct repository for you depending on some conditions. It is not difficult, just make an implementation and register it after AddExtCore, and it will override the standard implementation, so yours one will be used.
    2. Not sure about that :(
  2. postb99 commented on Aug 17, 2021

    @postb99
    1. Yes, you can provide --context argument for DbContext to use: https://docs.microsoft.com/en-us/ef/core/cli/dotnet#common-options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions