Comments (3)
Hi,
Your question is difficult because it depends on your software architecture. But I advice you to centralize and test the code of your application layer in libraries as in my example and to use a dependency injection library in your application to configure your command and query handlers. Then you can use and create commands and queries in your controller or presenter and process these commands and queries with a query or command processor based on dependency injection (you can find here an implementation of a command processor based on dependency injection). In a microservices architecture, commands, queries and results of queries are just DTOs used in the API of a microservice. This API is fine-grained and is often not exposed to your client but used by an API gateway that defines a coarse-grained API adapted to your client's needs.
from ddd.
Thank you for answer,
I working on your sample project "HealthcareDelivery" and I've trouble injecting dependency into the API layer. Would you please make API layer for "HealthcareDelivery" project and inject dependency or help me make it.
Thanks in advance
from ddd.
Hi,
It's a good idea. I've already thought about it but I don't have time at the moment to implement it. I will do it soon. You can get inspired by this chunk of code using SimpleInjector :
var assemblies = GetAssembliesToScan();
container.Register(typeof(IMappingProcessor), () => new MappingProcessor(container));
container.Register(typeof(ICommandProcessor), () => new CommandProcessor(container));
container.Register(typeof(IQueryProcessor), () => new QueryProcessor(container));
container.Register(typeof(IEventPublisher), () => new EventPublisher());
container.Register(typeof(ICommandHandler<>), assemblies);
container.Register(typeof(IQueryHandler<,>), assemblies);
container.Register(typeof(ICommandValidator<>), typeof(FluentCommandValidatorAdapter<>));
container.Register(typeof(IQueryValidator<>), typeof(FluentQueryValidatorAdapter<>));
container.Register(typeof(IValidator<>), assemblies);
container.Register(typeof(IRepository<>), assemblies);
container.Register(typeof(IObjectTranslator<,>), assemblies);
container.Register(typeof(IObjectMapper<,>), assemblies);
from ddd.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ddd.