Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 4. DI patterns > Method Injection

4.3. Method Injection

How can we inject a Dependency into a class when it’s different for each operation?

BY SUPPLYING IT AS A METHOD PARAMETER.

Figure 4.7. A Client creates an instance of SomeClass, but first injects an instance of the DEPENDENCY ISomeInterface with each method call.



  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial