Constructor injection question

8 views
Skip to first unread message

epitka

unread,
Oct 3, 2009, 8:21:11 PM10/3/09
to structuremap-users
Hi,
I just started looking at the structure map and I wonder if I can use
it in the following scenario. I use MVP and my presenters have
dependencies on the view in which they are instantiated and on the
service like this

MyPresenter (IMyView view, IMyService service, IMyMappingEngine
mapper)

How can I use SM to wire dependency on the IMyView dynamically, yet
wire service and mapper based on the configuration?

Jeremy D. Miller

unread,
Oct 3, 2009, 10:14:40 PM10/3/09
to structure...@googlegroups.com
Are you doing MVP with WebForms, or MVP with WPF/WinForms? 

I'm guessing you're talking about using the container to build the Presenter inside the view constructor like you'd have to if you're still in WebForms.  If that's the case, I think you just need to do this:  http://structuremap.sourceforge.net/RetrievingServices.htm#section5
 
Jeremy D. Miller
The Shade Tree Developer
jeremy...@yahoo.com



From: epitka <exptra...@yahoo.com>
To: structuremap-users <structure...@googlegroups.com>
Sent: Saturday, October 3, 2009 7:21:11 PM
Subject: [sm-users] Constructor injection question

epitka

unread,
Oct 3, 2009, 11:04:55 PM10/3/09
to structuremap-users
Great, that is what I was looking for. Thanks bunch.

On Oct 3, 9:14 pm, "Jeremy D. Miller" <jeremydmil...@yahoo.com> wrote:
> Are you doing MVP with WebForms, or MVP with WPF/WinForms?  
>
> I'm guessing you're talking about using the container to build the Presenter inside the view constructor like you'd have to if you're still in WebForms.  If that's the case, I think you just need to do this:  http://structuremap.sourceforge.net/RetrievingServices.htm#section5
>
>  Jeremy D. Miller
> The Shade Tree Developer
> jeremydmil...@yahoo.com
>
> ________________________________
> From: epitka <exptrade2...@yahoo.com>
Reply all
Reply to author
Forward
0 new messages