コード例 #1
0
        /// <summary>
        /// See <see cref="IBuilderStrategy.BuildUp"/> for more information.
        /// </summary>
        public override object BuildUp(IBuilderContext context, Type typeToBuild, object existing, string idToBuild)
        {
            WorkItem workItem = context.Locator.Get<WorkItem>(new DependencyResolutionLocatorKey(typeof(WorkItem), null));
            ObjectBuiltNotificationPolicy.ItemNotification notification;

            if (policy == null)
                policy = context.Policies.Get<ObjectBuiltNotificationPolicy>(null, null);

            if (workItem != null && !Object.ReferenceEquals(workItem, existing) && policy.AddedDelegates.TryGetValue(workItem, out notification))
                notification(existing);

            return base.BuildUp(context, typeToBuild, existing, idToBuild);
        }
        /// <summary>
        /// See <see cref="IBuilderStrategy.BuildUp"/> for more information.
        /// </summary>
        public override object BuildUp(IBuilderContext context, Type typeToBuild, object existing, string idToBuild)
        {
            WorkItem workItem = context.Locator.Get <WorkItem>(new DependencyResolutionLocatorKey(typeof(WorkItem), null));

            ObjectBuiltNotificationPolicy.ItemNotification notification;

            if (policy == null)
            {
                policy = context.Policies.Get <ObjectBuiltNotificationPolicy>(null, null);
            }

            if (workItem != null && !Object.ReferenceEquals(workItem, existing) && policy.AddedDelegates.TryGetValue(workItem, out notification))
            {
                notification(existing);
            }

            return(base.BuildUp(context, typeToBuild, existing, idToBuild));
        }