-
-
Notifications
You must be signed in to change notification settings - Fork 836
Commit
…utable.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,6 +172,7 @@ private static void StartStartableComponents(IComponentContext componentContext) | |
/// </remarks> | ||
/// <param name="container">An existing container to make the registrations in.</param> | ||
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Justification = "You can't update any arbitrary context, only containers.")] | ||
[Obsolete("Containers should generally be considered immutable. Register all of your dependencies before building/resolving. If you need to change the contents of a container, you technically should rebuild the container. This method may be removed in a future major release.")] | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
MpDzik
|
||
public void Update(IContainer container) | ||
{ | ||
Update(container, ContainerBuildOptions.None); | ||
|
@@ -188,6 +189,7 @@ public void Update(IContainer container) | |
/// <param name="container">An existing container to make the registrations in.</param> | ||
/// <param name="options">Options that influence the way the container is updated.</param> | ||
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Justification = "You can't update any arbitrary context, only containers.")] | ||
[Obsolete("Containers should generally be considered immutable. Register all of your dependencies before building/resolving. If you need to change the contents of a container, you technically should rebuild the container. This method may be removed in a future major release.")] | ||
public void Update(IContainer container, ContainerBuildOptions options) | ||
{ | ||
// Issue #462: The ContainerBuildOptions parameter is added here as an overload | ||
|
@@ -208,7 +210,23 @@ public void Update(IContainer container, ContainerBuildOptions options) | |
/// - this prevents ownership issues for provided instances. | ||
/// </remarks> | ||
/// <param name="componentRegistry">An existing registry to make the registrations in.</param> | ||
[Obsolete("Containers should generally be considered immutable. Register all of your dependencies before building/resolving. If you need to change the contents of a container, you technically should rebuild the container. This method may be removed in a future major release.")] | ||
public void Update(IComponentRegistry componentRegistry) | ||
{ | ||
this.UpdateRegistry(componentRegistry); | ||
} | ||
|
||
/// <summary> | ||
/// Configure an existing registry with the component registrations | ||
/// that have been made. Primarily useful in dynamically adding registrations | ||
/// to a child lifetime scope. | ||
/// </summary> | ||
/// <remarks> | ||
/// Update can only be called once per <see cref="ContainerBuilder"/> | ||
/// - this prevents ownership issues for provided instances. | ||
/// </remarks> | ||
/// <param name="componentRegistry">An existing registry to make the registrations in.</param> | ||
internal void UpdateRegistry(IComponentRegistry componentRegistry) | ||
{ | ||
if (componentRegistry == null) throw new ArgumentNullException(nameof(componentRegistry)); | ||
Build(componentRegistry, true); | ||
|
I really need
Update
the container on my project. How can i handle this, i mean, how rebuild works ?