It seems that the new unity version has added support for autowiring.
How many of you are familiar with it and I recommend using it or not? I think that its use limits my control over the DI, especially in relation to unit tests, am I thinking wrong?
"post-text" itemprop = "lesson">
I'm assuming that this question is about auto-registration , because Unity has self-wiring for years There is a system. As I wrote my article a couple of years ago, I have become a little more radical in my attitude towards Di Containers only.
The order of my choice is now:
In that article, I describe the benefits of using Di Containers and the trade-off. - Manually write (poor man's DI) code may look like a lot of trouble, but gives you, as well as easier to understand than DI container.
- Use auto registration (AK Connection on Configuration) When you lose compile-time feedback, the mechanism can actually drag your code to more of the stability, because when As far as you follow the conventions, things are 'just work', however, it is necessary for the team to be comfortable with the Container auto-registration API, which is not likely to be a case in my experience.
- Only if you have to use a clear register to do this: The reason for a very strong (and not: D is not a good reason to properly understand D) These days, I never do this So, it is difficult for me to come in some good cases, but advanced life management can be an inspiration.
In any production code, DI container.
In summary, and in an effort to answer specific questions about unity:
- Consider not to use unity seriously (or any other dis Container).
- If you use should unity, then use the auto-registration feature Otherwise, you may have more trouble than profit from it. is. Warning: I am writing this as a general reaction, based on my experience, DI and various di containers, which includes clear registration and auto registration. . Although I have some information about previous versions of Unity, but I do not know anything about the auto-registration features of the new version of Unity.
Comments
Post a Comment