Mastering Ninject for Dependency Injection


Mastering Ninject for Dependency Injection
eBook: $19.99
Formats: PDF, PacktLib, ePub and Mobi formats
$16.99
save 15%!
Print + free eBook + free PacktLib access to the book: $52.98    Print cover: $32.99
$32.99
save 38%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Create loosely coupled applications by implementing dependency injection using Ninject
  • Learn how to design an enterprise application so as to maximize its maintainability, extensibility and testability
  • Automate the process of dealing with the dependencies of your application and object lifetimes
  • Address the cross-cutting concerns of your applications in the easiest way
  • Full of real-life, step-by-step examples and clear code samples

Book Details

Language : English
Paperback : 142 pages [ 235mm x 191mm ]
Release Date : September 2013
ISBN : 1782166203
ISBN 13 : 9781782166207
Author(s) : Daniel Baharestani
Topics and Technologies : All Books, Application Development, Open Source

Table of Contents

Preface
Chapter 1: Understanding Dependency Injection
Chapter 2: Getting Started with Ninject
Chapter 3: Meeting Real-world Requirements
Chapter 4: Ninject in Action
Chapter 5: Doing More with Extensions
Index
    • Chapter 2: Getting Started with Ninject
      • Hello Ninject!
      • It's all about Binding
      • Object Lifetime
        • Transient scope
        • Singleton scope
        • Thread scope
        • Request scope
        • Custom scope
      • Ninject modules
      • XML configuration
        • How to use XML configuration
      • Convention over configuration
        • Selecting the assemblies
        • Selecting the components
          • Filtering the selected components
          • Explicit inclusion and exclusion
        • Selecting service types
        • Configuring the Bindings
      • Summary
      • Chapter 3: Meeting Real-world Requirements
        • DI patterns and antipatterns
          • Constructor Injection
          • Initializer methods and properties
          • Service Locator
        • Multi binding and contextual binding
          • Implementing the plugin model
          • Contextual binding
            • Named binding
            • Resolving metadata
            • Attribute-based binding
            • Target-based conditions
            • Generic helper
        • Custom providers
          • Activation context
          • The Factory Method
        • Dynamic factories
          • The Shape Factory example
          • Using convention
            • Selecting service types
            • Defining Binding Generator
          • Telecom Switch example
          • Custom Instance Providers
          • Func
          • Lazy
        • Summary
        • Chapter 4: Ninject in Action
          • Windows Forms applications
          • WPF and Silverlight applications
          • ASP.NET MVC applications
            • Validator injection
            • Filter injection
              • Conditional filtering (When)
              • Contextual arguments (With)
          • WCF applications
          • ASP.NET Web Forms applications
          • Summary
          • Chapter 5: Doing More with Extensions
            • Interception
              • Setup Interception
              • Member Interception
              • Type Interception
              • Multiple Interceptors
              • InterceptAttribute
            • Mocking Kernel
            • Extending Ninject
            • Summary

            Daniel Baharestani

            Daniel Baharestani is an experienced IT professional living in Australia. He has over 10 years of professional experience in design and development of enterprise applications, mostly focused on Microsoft technologies and holds a B.Sc in software engineering. Daniel is currently working at 3P Learning, which is a global leader in online learning with its flagship platform, Mathletics—used by more than 4 million students worldwide. For further details you can visit his website at http://baharestani.com.
            Sorry, we don't have any reviews for this title yet.

            Code Downloads

            Download the code and support files for this book.


            Submit Errata

            Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


            Errata

            - 2 submitted: last submission 07 Apr 2014

            Page No: 79 Type: Code-related

            It is :Now that we are done with CustomerForm, we need to show it from  MainForm  in
            the  Click event handler of  saveButton

             

            It should be: Now that we are done with CustomerForm, we need to show it from  MainForm  in
            the  Click event handler of  createButton

             

            It is : Introducing a new dependency to  CustomerForm in constructor, because  
            this way we will receive only one instance of  CustomerForm, while after
            closing that instance, we will need another one for subsequent clicks on the
            Save button

             

            It should be:Introducing a new dependency to  CustomerForm in constructor, because  
            this way we will receive only one instance of  CustomerForm, while after
            closing that instance, we will need another one for subsequent clicks on the
            Create button

            Pg No;80  Errata type: Code related

            It is: private void saveButton_Click(object sender, EventArgs e)

             

            It should be: private void createButton_Click(object sender, EventArgs e)

            Sample chapters

            You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

            Frequently bought together

            Mastering Ninject for Dependency Injection +    Haskell Data Analysis Cookbook =
            50% Off
            the second eBook
            Price for both: A$38.05

            Buy both these recommended eBooks together and get 50% off the cheapest eBook.

            What you will learn from this book

            • Understand dependency injection, how it is different from similar patterns such as inversion of control, and the problems that it addresses
            • Set up Ninject in an application and configure it either using XML or programmatically
            • Learn how to control object life-time by configuring object scopes
            • Wire up abstract service types to concrete implementations using bindings
            • Create plugins to add new features to compiled applications dynamically
            • Use Ninject in different application types such as Win Forms, Web Forms, WPF, Silverlight, ASP.NET MVC, and WCF
            • Inject common loggers such as log4net and NLog automatically into application components
            • Test application units and automate the injection of mock objects by integrating Ninject with common mock frameworks (for example Moq or Rhino Mock)
            • Register hundreds of bindings in a single line of code using the Convention configuration
            • Inject the implementation of cross-cutting concerns such as logging, exception handling, or caching by interception

            In Detail

            Dependency injection is an approach to creating loosely coupled applications. Maintainability, testability, and extensibility are just a few advantages of loose coupling. Ninject is a software library which automates almost everything that we need in order to implement a dependency injection pattern.

            Mastering Ninject for Dependency Injection will teach you everything you need to know in order to implement dependency injection using Ninject in a real-life project. Not only does it teach you about Ninject core framework features that are essential for implementing dependency injection, but it also explores the power of Ninject’s most useful extensions and demonstrates how to apply them.

            Mastering Ninject for Dependency Injection starts by introducing you to dependency injection and what it’s meant for with the help of sufficient examples.

            Eventually, you’ll learn how to integrate Ninject into your practical project and how to use its basic features. Also, you will go through scenarios wherein advanced features of Ninject, such as Multi-binding, Contextual binding, providers, factories and so on, come into play. As you progress, Mastering Ninject for Dependency Injection will show you how to create a multilayer application that demonstrates the use of Ninject on different application types such as MVC, WPF, WCF, and so on. Finally, you will learn the benefits of using the powerful extensions of Ninject.

            Approach

            Mastering Ninject for Dependency Injection teaches you the most powerful concepts of Ninject in a simple and easy-to-understand format using lots of practical examples, diagrams, and illustrations.

            Who this book is for

            Mastering Ninject for Dependency Injection is aimed at software developers and architects who wish to create maintainable, extensible, testable, and loosely coupled applications. Since Ninject targets the .NET platform, this book is not suitable for software developers of other platforms. Being familiar with design patterns such as singleton or factory would be beneficial, but no knowledge of dependency injection or IoC is assumed.

            Code Download and Errata
            Packt Anytime, Anywhere
            Register Books
            Print Upgrades
            eBook Downloads
            Video Support
            Contact Us
            Awards Voting Nominations Previous Winners
            Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
            Resources
            Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software