/// <summary>
        /// Called at runtime, creates the implementation of the <see cref="INotifyCollectionChange"/> interface.
        ///
        /// NOTE: tries to get implementation of aspect from instance, othrewise create a new one
        /// this is critical for objects with multiple constructors (see generated code in Reflector)
        /// </summary>
        /// <param name="eventArgs">Execution context.</param>
        /// <returns>A new instance of <see cref="NotifyCollectionChangeImplementation"/>, which implements
        /// <see cref="INotifyCollectionChange"/>.</returns>
        public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs)
        {
            InstanceCredentials credentials = eventArgs.InstanceCredentials;

            if (logging)
            {
                /*
                 *              log.DebugFormat("Creating new instance of interceptor for object {0}, credentials: {1}",
                 *                              eventArgs.Instance,
                 *                              InstanceCredentialsConvertor.ToString(eventArgs.InstanceCredentials));
                 */
            }
            object implementation =
                ((IComposed <INotifyCollectionChange>)eventArgs.Instance).GetImplementation(
                    eventArgs.InstanceCredentials);

            if (implementation != null)
            {
                if (logging)
                {
/*
 *                  log.DebugFormat(
 *                      "Instance already has an implementation injected - returning it and updating credentials {0} > ({1})",
 *                      ((NotifyCollectionChangeImplementation) implementation).InstanceCredentials,
 *                      InstanceCredentialsConvertor.ToString(credentials));
 */
                }
                ((NotifyCollectionChangeImplementation)implementation).InstanceCredentials =
                    credentials.ToString();
            }

            return(implementation ??
                   new NotifyCollectionChangeImplementation(eventArgs.Instance, eventArgs.InstanceCredentials, logging));
        }
        /// <summary>
        /// Called at runtime, creates the implementation of the <see cref="INotifyPropertyChange"/> interface.
        ///
        /// NOTE: tries to get implementation of aspect from instance, othrewise create a new one
        /// this is critical for objects with multiple constructors (see generated code in Reflector)
        /// </summary>
        /// <param name="eventArgs">Execution context.</param>
        /// <returns>A new instance of <see cref="NotifyPropertyChangeImplementation"/>, which implements
        /// <see cref="INotifyPropertyChange"/>.</returns>
        public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs)
        {
            var    instanceCredentials = eventArgs.InstanceCredentials;
            object implementation      = ((IComposed <INotifyPropertyChange>)eventArgs.Instance).GetImplementation(instanceCredentials);

            return(implementation ??
                   new NotifyPropertyChangeImplementation(eventArgs.Instance, eventArgs.InstanceCredentials, logging));
        }
        /// <summary>
        /// Called at runtime, creates the implementation of the <see cref="INotifyPropertyChanged"/> interface.
        /// 
        /// NOTE: tries to get implementation of aspect from instance, othrewise create a new one
        /// this is critical for objects with multiple constructors (see generated code in Reflector)
        /// </summary>
        /// <param name="eventArgs">Execution context.</param>
        /// <returns>A new instance of <see cref="NotifyPropertyChangedImplementation"/>, which implements
        /// <see cref="INotifyPropertyChanged"/>.</returns>
        public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs)
        {
            var instanceCredentials = eventArgs.InstanceCredentials;
            object implementation = ((IComposed<INotifyPropertyChanged>) eventArgs.Instance).GetImplementation(instanceCredentials);

            return implementation ??
                   new NotifyPropertyChangedImplementation(eventArgs.Instance, eventArgs.InstanceCredentials, logging);
        }
        /// <summary>
        /// Invoked at runtime at the entry of the constructor of the class to which
        /// this custom attribute is applied.
        /// </summary>
        /// <param name="eventArgs">Context information.</param>
        /// <returns>The implementation of the <see cref="IConfigurable"/>
        /// interface. </returns>
        public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs)
        {
            // Check that we got a container provider.
            if (this.containerProvider == null)
            {
                throw new InvalidOperationException(
                    "No container provider has been defined. Use the DefaultUnityContainerProviderAttribute custom attribute to specify an assembly-wide provider, or specify it in the constructor of the ConfigurableAttribute custom attribute.");
            }

            // Initialize the object.
            this.containerProvider.CurrentContainer.BuildUp(eventArgs.Instance.GetType(), eventArgs.Instance);

            // Create the implementation of IConfigurable and return it.
            return new ConfigurableImpl(this.containerProvider.CurrentContainer);
        }
Example #5
0
 public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs)
 {
     return(new NotifyPropertyChangedImplementation(eventArgs.Instance));
 }
 public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs)
 {
     return new DataErrorInfoImplementation(eventArgs.Instance);
 }
 /// <summary>
 /// Called at runtime, creates the implementation of the <see cref="INotifyPropertyChanged"/> interface.
 /// </summary>
 /// <param name="eventArgs">Execution context.</param>
 /// <returns>A new instance of <see cref="NotifyPropertyChangedImplementation"/>, which implements
 /// <see cref="INotifyPropertyChanged"/>.</returns>
 public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs)
 {
     return(new InstanceTracker(eventArgs.Instance));
 }
Example #8
0
 public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs)
 {
     return new NotifyPropertyChangedImplementation(eventArgs.Instance);
 }
        /// <summary>
        /// Called at runtime, creates the implementation of the <see cref="INotifyCollectionChanged"/> interface.
        /// 
        /// NOTE: tries to get implementation of aspect from instance, othrewise create a new one
        /// this is critical for objects with multiple constructors (see generated code in Reflector)
        /// </summary>
        /// <param name="eventArgs">Execution context.</param>
        /// <returns>A new instance of <see cref="NotifyCollectionChangedImplementation"/>, which implements
        /// <see cref="INotifyCollectionChanged"/>.</returns>
        public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs)
        {
            InstanceCredentials credentials = eventArgs.InstanceCredentials;
            if (logging)
            {
                /*
                                log.DebugFormat("Creating new instance of interceptor for object {0}, credentials: {1}",
                                                eventArgs.Instance,
                                                InstanceCredentialsConvertor.ToString(eventArgs.InstanceCredentials));
                */
            }
            object implementation =
                ((IComposed<INotifyCollectionChanged>) eventArgs.Instance).GetImplementation(
                    eventArgs.InstanceCredentials);

            if (implementation != null)
            {
                if (logging)
                {
/*
                    log.DebugFormat(
                        "Instance already has an implementation injected - returning it and updating credentials {0} > ({1})",
                        ((NotifyCollectionChangedImplementation) implementation).InstanceCredentials,
                        InstanceCredentialsConvertor.ToString(credentials));
*/
                }
                ((NotifyCollectionChangedImplementation) implementation).InstanceCredentials =
                    credentials.ToString();
            }

            return implementation ??
                   new NotifyCollectionChangedImplementation(eventArgs.Instance, eventArgs.InstanceCredentials, logging);
        }
Example #10
0
 /// <summary>
 /// Called at runtime, creates the implementation of the <see cref="IEditableObject"/> interface.
 /// </summary>
 /// <param name="eventArgs">Execution context.</param>
 /// <returns>A new instance of <see cref="EditableObjectImplementation"/>, which implements
 /// <see cref="IEditableObject"/>.</returns>
 public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs)
 {
     return(new EditableObjectImplementation(eventArgs.Instance as IProtectedInterface <IEditableObject>,
                                             eventArgs.InstanceCredentials));
 }
Example #11
0
 public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs)
 {
     return(new ValidatableImplementation(eventArgs.Instance));
 }
 /// <summary>
 /// Called at runtime, creates the implementation of the <see cref="INotifyPropertyChanged"/> interface.
 /// </summary>
 /// <param name="eventArgs">Execution context.</param>
 /// <returns>A new instance of <see cref="NotifyPropertyChangedImplementation"/>, which implements
 /// <see cref="INotifyPropertyChanged"/>.</returns>
 public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs)
 {
     return new InstanceTracker(eventArgs.Instance);
 }
 public override object CreateImplementationObject(InstanceBoundLaosEventArgs eventArgs)
 {
     return(new TagableImpl());
 }