Timeline for Unity Dependency Injection and Helper functions
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 3, 2018 at 22:18 | comment | added | Doc Brown | @Rick: a non-static helper class which was formerly static can most probably constructed in the constructor of MyController and assigned to a new member variable _validator. So instead of writing Validator.Validate(userData, _systemSettingService) you will have to write _validator.Validate(userData). | |
| Feb 3, 2018 at 15:55 | comment | added | Percy | My babbling meant to say Validate is a static function in a static class. Suppose I made the Helper class non-static, without DI then I would still have to have an instance of the _systemSettingService where ever I used the helper class - something that I may not necessarily have without passing the instance all over the place - would this scenario make you use DI? If yes, how would I create the helper class as and when needed in the code? | |
| Feb 3, 2018 at 14:08 | history | edited | Doc Brown | CC BY-SA 3.0 | added 377 characters in body |
| Feb 3, 2018 at 14:03 | history | edited | Doc Brown | CC BY-SA 3.0 | added 377 characters in body |
| Feb 3, 2018 at 13:55 | history | answered | Doc Brown | CC BY-SA 3.0 |