Skip to content

How to use multiple providers #15

Description

@juancampuzano

How can I use multiple providers, for example InMemory and JsonApi?

Activity

  1. dpimonov commented on Aug 23, 2023

    @dpimonov
    Contributor

    Hi @juancampuzano, EntityStore in general accepts any implementation of EntityProvider. You can simply initiate entity store 2 times. One with InMemory and another with JsonApi. Just allow your application store accept an instance of EntityProvider and pass it to the parent constructor.

    const inMemoryStore = new AppStore(new InMemoryEntityProvider());
    const jsonApiStore = new AppStore(new JsonApiEntityProvider());
    

    EntityStore base class also contains optional second argument - type manager instance. But until there is no overlap in configuration or requirement to have configuration groups - it is not required.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions