> OIC
IOC - fat fingers From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Nic Roche Sent: Thursday, 5 August 2010 8:43 PM To: 'ozDotNet' Subject: RE: Dependency Injection Hi Peter, Sorry _not_ to address your issues directly. The promotion patterns and practices is more valuable than the tools these guys (patterns and practices team) have delivered. This read gives a very good perspective: The Build Your Own CAB Series. http://codebetter.com/blogs/jeremy.miller/archive/2007/07/25/the-build-your- own-cab-series-table-of-contents.aspx Caliburn is a framework built from the ground up with OIC/Testability/MVVM/MVP/MVC in mind. http://caliburn.codeplex.com/ http://www.codeproject.com/KB/WPF/Caliburn_Module_Loading.aspx Regards, Nic Roche From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Maddin, Peter Sent: Thursday, 5 August 2010 7:56 PM To: ozdotnet@ozdotnet.com Subject: Dependency Injection I am experimenting with Dependency Injection in the Microsoft CAB framework. >From http://blog.irm.se/blogs/home.aspx?App=eric <http://blog.irm.se/blogs/home.aspx?App=eric&p=11> &p=11 Who says In this post I'm back covering the CreateNew attribute that you can use in a class that is instantiated by ObjectBuilder <http://www.codeplex.com/Wiki/View.aspx?ProjectName=ObjectBuilder> . Marking a property (or parameter to a method or constructor) with the CreateNew attributes will set that property to an instance of the object. The instance itself will of course be built by the ObjectBuilder too. A great example of when to use this functionality is if you want to implement your GUI with for example the Model View Presenter (MVP) design pattern. I will only focus on the View and Presenter here. I have this basic piece of code private ContentPresenter _contentPresenter; [CreateNew] public ContentPresenter Presenter { get { return _contentPresenter; } set { _contentPresenter = value;} } The objectBuilder may instantiate the ContentPresenter for me but I suspect it wil use the the default parameterless constructer (or expect one). How can I pass a parameter (in this case a reference to my view that implements the interface that will be used By my presenter. I have a solution that does not use Dependency Injection but would like the advantages of loose coupling if possible. Has anyone played (sorry used) the ObjectBuilder in the CAB framework for dependancy injection of this type and if so how can it be used to specify a constructor with a parameter. I have looked at the attributes here http://www.ikriv.com/en/prog/info/dotnet/CabDependencyInjection/DependencyAt tributes.html#CreateNew But that has not helped me much (actually not at all in fact). I am a sub novice (if one can get that low) with Dependancy Injection. Regards Peter Maddin Applications Development Officer PathWest Laboratory Medicine WA Phone : +618 9473 3944 Fax : +618 9473 3982 E-Mail : peter.mad...@pathwest.wa.gov.au The contents of this e-mail transmission outside of the WAGHS network are intended solely for the named recipient's), may be confidential, and may be privileged or otherwise protected from disclosure in the public interest. The use, reproduction, disclosure or distribution of the contents of this e-mail transmission by any person other than the named recipient(s) is prohibited. If you are not a named recipient please notify the sender immediately.