Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangodong committed Dec 20, 2015
1 parent 909983f commit 10cfa67
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
# simple-object-factory
Simple Object Factory to support Dependency Injection pattern in .NET

Simple Object Factory supports Dependency Injection pattern in .NET. SOF simplifies creation of types with chained dependencies. SOF is reflection-based constructor-injection library.

Usage:

// Class definitions:

public class Foo
{
}

public class Bar
{
public Bar(Foo foo)
{
}
}

public class Baz
{
public Baz(Bar bar)
{
}
}

// Instantiate ObjectFactory and register types

ObjectFactory objectFactory = new ObjectFactory();
objectFactory.RegisterType<Foo>();
objectFactory.RegisterType<Bar>();
objectFactory.RegisterType<Baz>();

// Automatically instantiate registered types

Foo foo = objectFactory.GetInstance<Foo>();
Bar bar = objectFactory.GetInstance<Bar>();
Baz baz = objectFactory.GetInstance<Baz>();
6 changes: 6 additions & 0 deletions SimpleObjectFactory/SimpleObjectFactory.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleObjectFactory", "Simp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleObjectFactory.Test", "..\SimpleObjectFactory.Test\SimpleObjectFactory.Test.csproj", "{9D500B3A-C6A3-4D58-B823-5357A6535D84}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{57E4AC12-DFE5-4D36-87EC-A88F80695D2F}"
ProjectSection(SolutionItems) = preProject
..\LICENSE = ..\LICENSE
..\README.md = ..\README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down

0 comments on commit 10cfa67

Please sign in to comment.