Skip to content

Simple, but confusing logic of LifetimeScope.Enqueue #319

Description

@longbombus

As I understand IContainerBuilder passed to LifetimeScope.Enqueue just adds registrations to each LifetimeScope in scene. So

using (Enqueue(
  builder =>
  {
    builder.Register<UniqueContext>(Lifetime.Singleton); // this is not Singleton for scene or prefab which context would to register
    builder.RegisterBuildCallback(c => Debug.Log("Extra scope container is ready")); // It executes every time for each scope in scene or prefab
  }
))

works right if loaded scene or created prefab contain only one scope.

Is it possible to make alternate Enqueue method which creates super-scope with passed builder?
Also it would be convenient to have ability to alternate IObjectResolver and LifetimeScope in hierarchy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions