PC Review


Reply
Thread Tools Rate Thread

What is Dependency Injection?

 
 
Anonieko
Guest
Posts: n/a
 
      14th Oct 2007
Pigsaw said...


"You don't want to hard code dependencies into your classes, because
then you can't test them without relying on the dependent classes. So
you "inject" those dependencies simply by setting them as properties -
possibly in the constructor, possibly with setter methods. And it
becomes all the easier if you have a little container which manages
how to configure those dependencies (properties) before they're
injected (set). "

Any shorter one?

 
Reply With Quote
 
 
 
 
nospam
Guest
Posts: n/a
 
      14th Oct 2007
Dependency injection is creating a wrapper around classes that your class
depends on.

You can than build stand-alone test cases that no longer "depend" on other
classes.


"Anonieko" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Pigsaw said...
>
>
> "You don't want to hard code dependencies into your classes, because
> then you can't test them without relying on the dependent classes. So
> you "inject" those dependencies simply by setting them as properties -
> possibly in the constructor, possibly with setter methods. And it
> becomes all the easier if you have a little container which manages
> how to configure those dependencies (properties) before they're
> injected (set). "
>
> Any shorter one?
>



 
Reply With Quote
 
Michael Nemtsev, MVP
Guest
Posts: n/a
 
      14th Oct 2007
Hello Anonieko,

read there http://www.martinfowler.com/articles/injection.html


---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


A> Pigsaw said...
A>
A> "You don't want to hard code dependencies into your classes, because
A> then you can't test them without relying on the dependent classes. So
A> you "inject" those dependencies simply by setting them as properties
A> - possibly in the constructor, possibly with setter methods. And it
A> becomes all the easier if you have a little container which manages
A> how to configure those dependencies (properties) before they're
A> injected (set). "
A>
A> Any shorter one?
A>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hand made method injection and prop.injection Raj Microsoft C# .NET 1 9th Apr 2010 03:13 PM
Dependency Injection with Castle Windsor - Free Event Skills Matter Microsoft Dot NET 0 2nd Oct 2008 11:42 AM
Understanding IoC and Dependency Injection. Frank Rizzo Microsoft C# .NET 11 25th Feb 2008 07:47 AM
Dependency Injection - Can It Be This Simple? Jordan S. Microsoft C# .NET 9 5th Feb 2008 05:40 PM
Dependency Error: The dependency <dll> in project <project> cannot be coppied to the run directory becuase it would conflict with dependency <dll> Jay A. Moritz Microsoft VB .NET 2 14th Apr 2005 07:57 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:24 PM.