
{
    using System;
    using System.Reflection;
    using ChannelAdam.DispatchProxies.Abstractions;

    /// <summary>
    /// Proxies the given object using the given handler using a Dispose Pattern on top of a <see cref="DispatchProxy"/>.
    /// </summary>
    /// <remarks>
    /// <para>
    /// Use the static factory method <c>Create</c> to create an instance.
    /// </para>
    /// <para>
    /// Dispose pattern implementation follows the approach used in ChannelAdam.Disposing.
    /// </para>
    /// </remarks>
    public class DisposableObjectDispatchProxy : Abstractions.Internal.CoreDisposableObjectDispatchProxy, IDisposable
    {
        /// <summary>
        /// This class must have a public constructor with no parameters - otherwise DispatchProxy.Create() will fail.
        /// </summary>
        public DisposableObjectDispatchProxy()
        {
        }

        /// <summary>
        /// Factory method to create a disposable object dispatch proxy with a destructor.
        /// </summary>
        /// <param name="objectToProxy">The actual object to be proxied.</param>
        /// <param name="invokeHandler">The handler for performing the proxying on the actual object.</param>
        /// <typeparam name="TObjectInterface">The interface of the object to be proxied.</typeparam>
        /// <returns>An instance of <see cref="DisposableObjectDispatchProxy"/>.</returns>
        public static TObjectInterface Create<TObjectInterface>(object objectToProxy, IObjectInvokeHandler invokeHandler)
        {
            /// Create an object that derives from <see cref="DisposableObjectDispatchProxy"/> and implements interface <c>TObjectInterface</c>.
            /// The class must have a public constructor with no parameters - otherwise <c>DispatchProxy.Create()</c> will fail.
            TObjectInterface dispatchProxy = DispatchProxy.Create<TObjectInterface, DisposableObjectDispatchProxy>();

            object? dispatchProxyAsObject = dispatchProxy;
            if (dispatchProxyAsObject is null)
            {
                throw new InvalidOperationException($"Unable to create the dispatch proxy object derived from DisposableObjectDispatchProxy with interface: {typeof(TObjectInterface).FullName}");
            }

            var objectDispatchProxy = (DisposableObjectDispatchProxy)dispatchProxyAsObject;
            objectDispatchProxy.ProxiedObject = objectToProxy?? throw new ArgumentNullException(nameof(objectToProxy));
            objectDispatchProxy.InvokeHandler = invokeHandler?? throw new ArgumentNullException(nameof(invokeHandler));

            return dispatchProxy;
        }

        #region Public Methods - Dispose Pattern

        /// <summary>
        /// Performs the deterministic, application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        /// <remarks>
        /// Implementation of <c>IDisposable.Dispose</c> method.
        /// </remarks>
        public void Dispose()
        {
            // Call the Dispose method and indicate we are calling it deterministically from our application code.
            // (Garbage collection calls finalisers that destroys managed objects non-deterministically.)
            base.Dispose(disposing:true);

            // This object is being cleaned up by the Dispose method.
            // Calling GC.SupressFinalize() takes this object off the finalization queue and prevents
            // finalization code for this object from executing a second time.
            GC.SuppressFinalize(this);
        }

        #endregion

        #region Protected Methods - Dispose Pattern - Abstract Implementations

        /// <summary>
        /// Dispose of managed resources here.
        /// </summary>
        /// <remarks>
        /// This releases them faster than if they were reclaimed non-deterministically from a finaliser.
        /// Call <c>SafeDispose()</c> on every managed resource that needs to be disposed.
        /// </remarks>
        protected override void DisposeManagedResources()
        {
            SafeDispose(this.ProxiedObject);
            SafeDispose(this.InvokeHandler);
        }

        /// <summary>
        /// Release unmanaged resources here.
        /// </summary>
        /// <remarks>
        /// The implementer is responsible for ensuring that they do not interact with managed objects that may have been reclaimed by the Garbage Collector.
        /// <remarks>
        protected override void DisposeUnmanagedResources()
        {
            // nothing to do here
        }

        /// <summary>
        /// Set the disposed resources to null to make them unreachable, and to prevent double disposal attempts.
        /// </summary>
        /// <remarks>
        /// This executes after all the Dispose*anagedResources*() methods.
        /// </remarks>
        protected override void SetResourcesToNull()
        {
            this.ProxiedObject = null;
            this.InvokeHandler = null;
        }

        #endregion

        #region Protected Methods - DispatchProxy - Overrides

        protected override object? Invoke(MethodInfo? targetMethod, object?[]? args)
        {
            if (targetMethod is null)
            {
                throw new ArgumentNullException(nameof(targetMethod));
            }

            object? result = null;

            try
            {
                if (this.IsDisposed)
                {
                    throw new ObjectDisposedException($"Calling {targetMethod.Name} while proxying via {this.GetType().FullName}");
                }

                if ("Dispose".Equals(targetMethod.Name, StringComparison.OrdinalIgnoreCase))
                {
                    // Invoke Dispose() on this proxy object, with hooks that should be overriden to invoke it on the actual object
                    this.Dispose();
                }
                else
                {
                    // Invoke the target method on the proxied/actual object via the handler
                    result = base.Invoke(targetMethod, args);
                }
            }
            catch (TargetInvocationException targetEx)
            {
                if (targetEx.InnerException!= null)
                {
                    // Unwrap the real exception from the TargetInvocationException
                    throw new AggregateException(new[] { targetEx.InnerException });
                }

                throw;
            }

            return result;
        }

        #endregion
    }
}
SOUTHBRIDGE — From the moment one walked in to the opening Thursday night for artist John Ferrara, the observer could only be truly amazed by the sheer beauty of his Oriental collection.
He had to select from the 80-piece collection to fit the room at Jacob Edwards Library. What is there, in color and expression, is nothing short of brilliant.
“John is showing such an eloquent celebration of female presence in this particular showing,” said Library Director Margaret Morrissey.
John Ferrara thinks of himself as a “journeyman artist,” who works with several mediums to create his art. Ferrara’s work is on display at the Jacob Edwards Library in Southbridge throughout the month.
He works in watercolor, acrylic, oil, chalk, ink and roller print.
The exhibit of works by John Ferrara will be on display through the month of January at the library. More examples of Mr. Ferrara’s work can be found on his website, www.artofjohnferrara.com.
Get free* and instant RNS news alerts by email, SMS text message or Twitter for Qihang Equip (QIH). Never miss another important Qihang Equip RNS news again by signing up and creating your QIH RNS alert.
Create Qihang Equip RNS alert...
If you are looking to setup an RNS alert for Qihang Equip then you have come to the right place. We offer Qihang Equip RNS alerts by email, Twitter Direct Message and SMS text message directly to your mobile phone. Setup your Qihang Equip RNS alert within seconds by registering your account. Find out more about our notification options below.Forum > Vehicles for Sale > Yahoo Goodness, Pity its got too many doors...
There was a hijet van near my house.
Ill have to do a drive by and see if it is still there and snap a pic.
Had a rotating flashing light on its roof, adds heaps of character to it.Vacuum Carburizing of AISI S7 Tool Steel

The effects of vacuum carburizing under an acetylene atmosphere at 950 and 1000, followed by gas quenching and tempering at various temperatures on the properties of AISI S7 shock-resistant tool steel were studied. As carburized specimens undergo low temperature tempering, the surface hardness of the quenched specimens carburized at 1000 is lower than those of the specimens carburized at 950, due to the large amount of retained austenite in specimens carburized at 1000. Under high temperature tempering, specimens carburized at 1000 have higher surface hardness than specimens carburized at 950. As specimens are tempered in