This article provides some options.. http://www.sqlservercentral.com/articles/T-SQL/61918/ <http://www.sqlservercentral.com/articles/T-SQL/61918/>
On Thu, Aug 5, 2010 at 7:56 PM, Maddin, Peter < peter.mad...@pathwest.wa.gov.au> wrote: > I am experimenting with Dependency Injection in the Microsoft CAB > framework. > > > > From http://blog.irm.se/blogs/home.aspx?App=eric&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/DependencyAttributes.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* > *Path**West 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.* > > >