Skip to content

Instantly share code, notes, and snippets.

@mczachurski
Last active February 22, 2018 16:05
Show Gist options
  • Save mczachurski/21d853352dddbfd4a7b3e594b6ca94bc to your computer and use it in GitHub Desktop.
Save mczachurski/21d853352dddbfd4a7b3e594b6ca94bc to your computer and use it in GitHub Desktop.
private func registerDatabase(container: DependencyContainer) {
container.register(.singleton) { SQLiteConnection(configuration: $0) as SqlConnectionProtocol }
container.register { DatabaseContext(sqlConnection: $0) as DatabaseContextProtocol }
}
private func registerRepositories(container: DependencyContainer) {
container.register { TasksRepository(databaseContext: $0) as TasksRepositoryProtocol }
container.register { UsersRepository(databaseContext: $0) as UsersRepositoryProtocol }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment