You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.6 KiB
45 lines
1.6 KiB
#include "DiContainer.h" |
|
#include "infrastructure/repositories/FileItemRepository.h" |
|
#include "infrastructure/adapters/SystemClock.h" |
|
#include "infrastructure/http/HttpOrderService.h" |
|
#include "infrastructure/http/HttpServer.h" |
|
#include "application/commands/AddItem.h" |
|
#include "webapi/controllers/StoreController.h" |
|
#include <filesystem> |
|
|
|
namespace nxl::autostore::di { |
|
|
|
DiContainer::DiContainer() |
|
{ |
|
registerDependencies(); |
|
} |
|
|
|
void DiContainer::registerDependencies() |
|
{ |
|
// Register shared references |
|
|
|
container.register_type<dingo::scope<dingo::shared>, |
|
dingo::storage<infrastructure::FileItemRepository>, |
|
dingo::interface<application::IItemRepository>>(); |
|
|
|
container.register_type<dingo::scope<dingo::shared>, |
|
dingo::storage<infrastructure::SystemClock>, |
|
dingo::interface<application::IClock>>(); |
|
|
|
container.register_type<dingo::scope<dingo::shared>, |
|
dingo::storage<infrastructure::HttpOrderService>, |
|
dingo::interface<application::IOrderService>>(); |
|
|
|
container.register_type<dingo::scope<dingo::shared>, |
|
dingo::storage<infrastructure::HttpServer>>(); |
|
|
|
container.register_indexed_type<dingo::scope<dingo::shared>, |
|
dingo::storage<application::AddItem>, |
|
dingo::interface<application::AddItem>>( |
|
std::string("AddItem")); |
|
|
|
// test: |
|
auto uc = container.resolve<application::AddItem>( |
|
std::string("AddItem")); // throws on start |
|
} |
|
} // namespace nxl::autostore::di
|
|
|