An_Overview Namespace

GWN Framework Contact Manager

An_Overview Namespace

Classes


  Class Description
Public class Contact_Manager

Public class Inversion_Of_Control

Normally processes will instantiate classes that it requires, e.g.,

    var logger = new DebugLogger();

In contrast, with Inversion of control (IOC), aka Dependency Injection, the control is given to the application and instances are passed into the process. For example any class within a IOC system can simply set a [Dependency] attribute above an interface and the instance will magically be provided by the application;

    [Dependency]
    public ILogger Logger { get; set; } 

This is extremely beneficial for examples such as that shown above; a Logger is a cross cutting concern that we may later want to change. For now it goes to the console and debug window. If later we want logging to be handled by the Enterprise Library or a SQL Server we can simply create a new implementation and in the App.Config configure it to use the new implementation - no other code changes are required.

Click the following link for a Dependency Injection Primer

Dependences are configured in two places - the App.Config and the Program.cs files.


Examples


C#
[Dependency]
public ILogger Logger { get; set; }

[Dependency]
public IDataAccessLayer GhostDocDal { get; set; }

Public class Quick_Start

{DocFile replacement=QuickStart.htm}