private static bool RequiresDbConnection(MethodInfo methodInfo) { if (UnitOfWorkHelper.HasUnitOfWorkAttribute(methodInfo)) { return(true); } if (UnitOfWorkHelper.IsConventionalUowClass(methodInfo.DeclaringType)) { return(true); } return(false); }
/// <summary> /// Gets UnitOfWorkAttribute for given method or null if no attribute defined. /// </summary> /// <param name="methodInfo">Method to get attribute</param> /// <returns>The UnitOfWorkAttribute object</returns> 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); }