문제

I am designing an app and I am using a n-layer architecture, I have:

- a presentation layer
- a domain bussines layer
- a data acccess layer
- a cross-cutting layer

Then I am trying to isolate my project from an specific DI framework, that is create my own IContainer interface and ensure that my components depends only to this interface.

Then I have 2 questions.

1 - Is this last a good practice ?

2 - (And the more important) Is dependency injection a cross-cutting concern ? That is can I place the DI related components in the cross-cutting layer ? If the answer is not where can fits those components.

I ask this because when I dive in the architecture design guides about cross-cutting concerns they usually mention:

- Security
- Validation
- Configuration handling
- Exception handling
- Loggings
- Caching
도움이 되었습니까?

해결책

Are you planning on changing DI frameworks? If not, there is no point in abstracting them.

DI is not a cross cutting concern. It is a technique to structure objects and dependencies between them.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top