Beispiel #1
0
 private static void ComponentRegistered(string key, IHandler handler)
 {
     if (UnitOfWorkHelper.IsConventionalUowClass(handler.ComponentModel.Implementation))
     {
         handler.ComponentModel.Interceptors.Add(new InterceptorReference(typeof(UnitOfWorkInterceptor)));
     }
     else if (handler.ComponentModel.Implementation.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Any(UnitOfWorkHelper.HasUnitOfWorkAttribute))
     {
         handler.ComponentModel.Interceptors.Add(new InterceptorReference(typeof(UnitOfWorkInterceptor)));
     }
 }
Beispiel #2
0
        internal static UnitOfWorkAttribute GetUnitOfWorkAttributeOrNull(MemberInfo methodInfo)
        {
            var attrs = methodInfo.GetCustomAttributes(typeof(UnitOfWorkAttribute), false);

            if (attrs.Length > 0)
            {
                return((UnitOfWorkAttribute)attrs[0]);
            }

            if (UnitOfWorkHelper.IsConventionalUowClass(methodInfo.DeclaringType))
            {
                return(new UnitOfWorkAttribute()); //Default
            }

            return(null);
        }