Skip to content

Commit

Permalink
Updated documentation about factories. Resolves #2.
Browse files Browse the repository at this point in the history
  • Loading branch information
intentor committed Apr 1, 2015
1 parent e562fbc commit 2c1cf26
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -654,20 +654,23 @@ namespace MyNamespace {
public class MyFactory : Adic.IFactory {
/// <summary>Type the factory creates.</summary>
Type factoryType {
get { return typeof(FactoryObjectType); }
get { return typeof(MyObjectType); }
}

/// <summary>
/// Creates an instance of the object of the type created by the factory.
/// </summary>
/// <param name="context">Injection context.</param>
/// <returns>The instance.</returns>
public object Create() {
public object Create(InjectionContext context);
...
}
}
}
```

The `InjectionContext` object contains information about the current injection/resolution, which can be used to help deciding how the instance will be created by the factory.

To bind a type to a factory class, use the `ToFactory()`:

```cs
Expand Down

0 comments on commit 2c1cf26

Please sign in to comment.