コード例 #1
0
        public override object PreBuildUp(IBuilderContext context)
        {
            //ValidationHelper.NotNull(context, "context");

            var policy = BuildTrackingPolicy.Get(context) ?? BuildTrackingPolicy.Set(context);

            //policy.Push(context.BuildKey);
            return(null);
        }
コード例 #2
0
        public void PostBuildUp(IBuilderContext context)
        {
            var policy = BuildTrackingPolicy.Get(context);

            if (policy != null && !policy.IsEmpty)
            {
                policy.Pop();
            }
        }
コード例 #3
0
        public static IBuildTrackingPolicy Set(IBuilderContext context)
        {
            //ValidationHelper.NotNull(context, "context");

            IBuildTrackingPolicy policy = new BuildTrackingPolicy();

            //context.Policies.SetDefault(policy);
            return(policy);
        }
コード例 #4
0
        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);
            }
        }