repositories in the context
The longevity context provides three different repositories:
- one that goes against your application database -
context.repo
- one that goes against your test database -
context.testRepo
- one that goes against an in-memory database -
context.inMemTestRepo
You should easily be able to inject these repositories into whatever dependency injection approach you are using. For instance, with Scaldi:
import longevity.persistence.Repo
import scala.concurrent.Future
import scaldi.Module
class PersistenceModule extends Module {
bind[Repo[Future, DomainModel]] to context.repo
}
class TestPersistenceModule extends Module {
bind[Repo[Future, DomainModel]] to context.testRepo
}