Skip to content

Commit

Permalink
Update child-lifetime.md
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmarbach committed Mar 11, 2024
1 parent 23d807b commit 2966ad8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions nservicebus/dependency-injection/child-lifetime.md
Expand Up @@ -16,11 +16,10 @@ Child containers are a snapshot of the main container providing an additional in

NServiceBus creates a child container for each transport message that is received. During message processing, all `InstancePerUnitOfWork` scoped instances that are created are resolved as singletons within the context of the same message. This is helpful to support the sharing of database sessions and other resources with lifetimes specific to the processed message.

Objects can be configured in a child container scope using the `InstancePerUnitOfWork` lifetime:
Objects can be configured in a child container scope using the scoped lifetime:

snippet: InstancePerUnitOfWorkRegistration


## Deterministic disposal

Child containers automatically dispose all [IDisposable](https://msdn.microsoft.com/en-us/library/system.idisposable.aspx) instances created with `InstancePerUnitOfWork` lifetime once the message is processed. This is useful for managing things like database sessions which must be disposed of properly.

0 comments on commit 2966ad8

Please sign in to comment.