Skip to content

Commit

Permalink
(GH-1294) API - Expose container directly
Browse files Browse the repository at this point in the history
Sometimes you need to get to an instance of something provided by
Chocolatey that is loaded into the container. Provide a way to get to
instances of items loaded on the container by accessing the container
directly.

Provide warning that once the container is accessed, no more items can
be registered on the container.
  • Loading branch information
ferventcoder committed May 15, 2017
1 parent 2738a8c commit bc1fff2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/chocolatey/GetChocolatey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,20 @@ public GetChocolatey RegisterContainerComponents(Action<Container> containerSetu
}

/// <summary>
/// Call this method to run chocolatey after you have set the options.
/// Returns the Chocolatey container.
/// WARNING: Once you call GetInstance of any kind, no more items can be registered on the container
/// </summary>
/// <returns>The IoC Container (implemented as a SimpleInjector.Container)</returns>
/// <remarks>
/// This requires you to use ILMerged SimpleInjector. If you use SimpleInjector in your codebase, you must now use Chocolatey's version. This is required to not be internalized so licensed code will work appropriately.
/// </remarks>
public Container Container()
{
return _container;
}

/// <summary>
/// Call this method to run Chocolatey after you have set the options.
/// </summary>
public void Run()
{
Expand Down

0 comments on commit bc1fff2

Please sign in to comment.