0

I have two applications, one is a Web API, and the other is a scheduled job.

Web API

  • First I run this service
  • There is an entity called 'User'
  • I'm adding some fake users using a DB Context called 'ApplicationContext'
  • The data will be persisted in an in-memory DB

Scheduled Job service (Background service)

  • Now I'm running this service and trying to access the same DbContext
  • But I don't see the fake users in the new context

How can I access the data in another application?

1
  • 3
    The InMemory database is used only inside the current process and is used for testing only anyway. You might want to use a "real" database or use API calls between these applications. Commented Jan 15, 2022 at 14:03

1 Answer 1

2

Your second application must access the DB via the API on the first. You can't access an in-memory database from another process without doing this.

The good news is, this means the first application enables you to expose higher level features than the bare database. This is mostly the entire purpose of a service.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.