Timeline for Advise on loose coupling between user controls
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 21, 2014 at 18:26 | vote | accept | Sunny | ||
| Apr 21, 2014 at 14:14 | comment | added | Magus | @moss23's answer explains exactly what I mean very clearly. | |
| Apr 19, 2014 at 14:39 | answer | added | moss23 | timeline score: 3 | |
| Apr 18, 2014 at 23:20 | comment | added | Sunny | Just curious to know, How can we abstract without referencing SearchControl. for ex. Search control implements ISearchView that has a property ShowSearchPanel. The panel needs to be closed when there are some results, so I am calling SearchControl.ShowSearchPanel = false in the results user control. | |
| Apr 18, 2014 at 23:06 | comment | added | Magus | That sounds about right, if the main page load event is where your Results class is constructed. The idea is, you make they objects and give them what they need before letting them use it. That's what Dependency Injection is. Now, I might try to abstract it so you don't directly reference SearchControl, but if you want to do that, you can plan something to implement it. | |
| Apr 18, 2014 at 23:01 | comment | added | Sunny | You mean, in the main page load event, assign the SearchControl property of the results control. This way all dependencies are resolved from main page. Is my understanding correct. | |
| Apr 18, 2014 at 22:36 | comment | added | Magus | It doesn't matter how you inject something, just that you DO inject something. You could simply pass it in from whatever context adds the UserControls. I'd probably make some kind of communication class for it, though. | |
| Apr 18, 2014 at 22:34 | comment | added | Sunny | Yes, it's a dependency but it is tied with user controls. I never configured .ascx.cs to the interface through dependency injection. | |
| Apr 18, 2014 at 22:31 | comment | added | Magus | I feel like what you're seeing here is a dependency, which might make it a good idea to inject it as a property. I'm not sure if the dependency is even the search control or just some form of communication, but I'd definitely try to avoid letting the UserControls access each other this way. This would be a simple [Import] with MEF, but that would have far larger complications. | |
| Apr 18, 2014 at 22:24 | history | asked | Sunny | CC BY-SA 3.0 |