/// <summary> /// Инициализирует экземпляр <see cref="AsyncDeterminingPipelineFactory"/>. /// </summary> /// <param name="methodInfoCache">Кеш методов.</param> /// <param name="cacheFactory">Фабрика кеша.</param> internal AsyncDeterminingPipelineFactory( IMethodInfoCache methodInfoCache, IKeyValueCacheFactory cacheFactory) { _cache = methodInfoCache; _cacheFactory = cacheFactory; }
/// <summary> /// Создает экземпляр прокси. /// </summary> /// <param name="target">Целевой объект</param> /// <param name="targetType">Тип целевого объекта.</param> /// <param name="declaringType">Тип интерфейса, реализуемого целевым классом.</param> /// <param name="invocationWeaveDataProvider">Провайдер данных о вызове.</param> /// <param name="aspectDependencyInjectorHolder">Компонент для внедрения зависимостей в аспекты.</param> /// <param name="aspectFinalizerHolder">Финализатор аспектов.</param> /// <param name="methodInfoCache">Кеш методов.</param> /// <returns>Экземпляр прокси.</returns> internal static object Create( object target, Type targetType, Type declaringType, IInvocationWeaveDataProvider invocationWeaveDataProvider, IComponentHolder <IAspectDependencyInjector> aspectDependencyInjectorHolder, IComponentHolder <IAspectFinalizer> aspectFinalizerHolder, IMethodInfoCache methodInfoCache) { var transparentProxy = ProxyGenerator.Instance.CreateTransparentProxy( typeof(AspectWeaveProxy), declaringType); var weavedProxy = (AspectWeaveProxy)transparentProxy; weavedProxy.Initialize( target, targetType, declaringType, invocationWeaveDataProvider, aspectDependencyInjectorHolder, aspectFinalizerHolder, methodInfoCache); return(transparentProxy); }
/// <summary> /// Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. /// </summary> /// <param name="x">The first object to compare.</param> /// <param name="y">The second object to compare.</param> /// <returns> /// A signed integer that indicates the relative values of <paramref name="x" /> and <paramref name="y" />, as shown in /// the following table.Value Meaning Less than zero<paramref name="x" /> is less than <paramref name="y" />.Zero /// <paramref name="x" /> equals <paramref name="y" />.Greater than zero<paramref name="x" /> is greater than /// <paramref name="y" />. /// </returns> public int Compare(IMethodInfoCache <TAtt, TArg> x, IMethodInfoCache <TAtt, TArg> y) { if (x == null) { return(-1); } if (y == null) { return(+1); } return(string.Compare(x.MethodName, y.MethodName, StringComparison.Ordinal)); }
#pragma warning disable CS1711 // XML comment has a typeparam tag, but there is no type parameter by that name /// <summary> /// Determines whether the specified objects are equal. /// </summary> /// <param name="x">The first object of type /// <typeparam name="TAtt" /> /// to compare. /// </param> /// <param name="y">The second object of type /// <typeparam name="TAtt" /> /// to compare. /// </param> /// <returns> /// true if the specified objects are equal; otherwise, false. /// </returns> public bool Equals(IMethodInfoCache <TAtt, TArg> x, IMethodInfoCache <TAtt, TArg> y) #pragma warning restore CS1711 // XML comment has a typeparam tag, but there is no type parameter by that name { if (x == null && y == null) { return(true); } if (x == null || y == null) { return(false); } if (x.MethodName != y.MethodName) { return(false); } return(x.MethodInfo.Equals(y.MethodInfo)); }
/// <summary> /// Выполняет инициализацию прокси. /// </summary> private void Initialize( object target, Type targetType, Type declaringType, IInvocationWeaveDataProvider invocationWeaveDataProvider, IComponentHolder <IAspectDependencyInjector> aspectDependencyInjectorHolder, IComponentHolder <IAspectFinalizer> aspectFinalizerHolder, IMethodInfoCache methodInfoCache) { Target = target; TargetType = targetType; DeclaringType = declaringType; Interceptor = new InvocationInterceptor( invocationWeaveDataProvider, aspectDependencyInjectorHolder, aspectFinalizerHolder); MethodCache = methodInfoCache; }
/// <summary> /// Compares the current instance with another object of the same type and returns an integer that indicates whether /// the current instance precedes, follows, or occurs in the same position in the sort order as the other object. /// </summary> /// <param name="other">An object to compare with this instance.</param> /// <returns> /// A value that indicates the relative order of the objects being compared. The return value has these meanings: Value /// Meaning Less than zero This instance precedes <paramref name="other" /> in the sort order. Zero This instance /// occurs in the same position in the sort order as <paramref name="other" />. Greater than zero This instance follows /// <paramref name="other" /> in the sort order. /// </returns> public int CompareTo(IMethodInfoCache <TAtt, TArg> other) { return(new MethodInfoCacheEquatableComparer <TAtt, TArg>().Compare(this, other)); }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <param name="other">An object to compare with this object.</param> /// <returns> /// true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false. /// </returns> public bool Equals(IMethodInfoCache <TAtt, TArg> other) { return(new MethodInfoCacheEquatableComparer <TAtt, TArg>().Equals(this, other)); }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <param name="obj">The object.</param> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public int GetHashCode(IMethodInfoCache <TAtt, TArg> obj) { return(obj.MethodInfo.GetHashCode()); }