Ejemplo n.º 1
0
 protected static Action CreatePreOperation(DependencyHandler dependency, List <Type> typeList) =>
 () => dependency.OnRegister += type => typeList.Add(type);
Ejemplo n.º 2
0
 protected static Action CreatePostOperation(DependencyHandler dependency, List <Type> typeList) =>
 () => typeList.Each(type => dependency.Unregister(type));
Ejemplo n.º 3
0
 /// <summary> Creates a scope which removes all dependencies that are registered within the scope from the dependency map when the scope ends. </summary>
 /// <remarks> Types registered inside the scope are not removed if they had already been registered to the shared dependency map outside the scope. </remarks>
 /// <param name="dependency"> The handler of shared dependencies. </param>
 public DependencyScope(DependencyHandler dependency)
     : base(new List <Type>().Into(typeList => new ScopedOperation(
                                       DependencyScope.CreatePreOperation(dependency, typeList),
                                       DependencyScope.CreatePostOperation(dependency, typeList))))
 {
 }