public override object PreBuildUp(IBuilderContext context) { //ValidationHelper.NotNull(context, "context"); var policy = BuildTrackingPolicy.Get(context) ?? BuildTrackingPolicy.Set(context); //policy.Push(context.BuildKey); return(null); }
public void PostBuildUp(IBuilderContext context) { var policy = BuildTrackingPolicy.Get(context); if (policy != null && !policy.IsEmpty) { policy.Pop(); } }
public static IBuildTrackingPolicy Set(IBuilderContext context) { //ValidationHelper.NotNull(context, "context"); IBuildTrackingPolicy policy = new BuildTrackingPolicy(); //context.Policies.SetDefault(policy); return(policy); }
public void PreBuildUp(IBuilderContext context) { //ValidationHelper.NotNull(context, "context"); string loggerName = String.Empty; if (context.BuildKey.Type.Equals(typeof(ILogger))) { IBuildTrackingPolicy buildTrackingPolicy = BuildTrackingPolicy.Get(context); if (buildTrackingPolicy != null && buildTrackingPolicy.Count >= 2) { loggerName = buildTrackingPolicy.ElementAt(1).Type.FullName; } else { loggerName = context.BuildKey.Name; } Debug.Assert(!String.IsNullOrEmpty(loggerName), "ILogger cannot be resolved with empty logger name. Set logger name to calling type FullName"); //var loggerCreationPolicy = context.Policies.Get<ILoggerCreationPolicy>(NamedTypeBuildKey.Make<ILogger>()); //context.Existing = loggerCreationPolicy.Create(loggerName); } }