コード例 #1
0
 public SpyExtension(BuilderStrategy strategy, UnityBuildStage stage, object policy, Type policyType)
 {
     this.strategy   = strategy;
     this.stage      = stage;
     this.policy     = policy;
     this.policyType = policyType;
 }
コード例 #2
0
 /// <summary>
 /// Adds a strategy to the chain at a particular stage.
 /// </summary>
 /// <param name="strategy">The strategy to add to the chain.</param>
 /// <param name="stage">The stage to add the strategy.</param>
 public void Add(BuilderStrategy strategy, TStageEnum stage)
 {
     lock (_lockObject)
     {
         _stages[Convert.ToInt32(stage)].Add(strategy);
     }
 }
コード例 #3
0
        private static object BuildResolveLazy <T>(ref BuilderContext context)
        {
            var container = context.Container;
            var name      = context.Name;

            context.Existing = new Lazy <T>(() => container.Resolve <T>(name));

            var lifetime = BuilderStrategy.GetPolicy <LifetimeManager>(ref context);

            if (lifetime is PerResolveLifetimeManager)
            {
                var perBuildLifetime = new InternalPerResolveLifetimeManager(context.Existing);
                context.Set(typeof(LifetimeManager), perBuildLifetime);
            }

            return(context.Existing);
        }
コード例 #4
0
 /// <summary>
 /// Adds a strategy to the chain.
 /// </summary>
 /// <param name="strategy">The strategy to add to the chain.</param>
 public void Add(BuilderStrategy strategy)
 {
     _strategies.Add(strategy);
 }
コード例 #5
0
 public SpyExtension(BuilderStrategy strategy, UnityBuildStage stage)
 {
     this.strategy = strategy;
     this.stage    = stage;
 }