protected ISqlCommand FindSqlCommand(IMethodInvocation invocation) { ISqlCommand cmd; Type targetType = GetComponentDef(invocation).ComponentType; IDaoMetaData dmd = _daoMetaDataFactory.GetDaoMetaData(targetType); if (typeof(OutsideSqlDao).IsAssignableFrom(targetType)) { cmd = dmd.GetSqlCommand(GenerateSpecifiedOutsideSqlUniqueKey(invocation)); } else { cmd = dmd.GetSqlCommand(invocation.Method.Name); } return(cmd); }
// =============================================================================== // SqlCommand // ========== protected void InitializeSqlCommand(IMethodInvocation invocation) { Type targetType = GetComponentDef(invocation).ComponentType; IDaoMetaData dmd = _daoMetaDataFactory.GetDaoMetaData(targetType); if (typeof(OutsideSqlDao).IsAssignableFrom(targetType)) { return; // Do nothing! } else { Object[] arguments = invocation.Arguments; if (arguments != null && arguments.Length > 0 && arguments[0] is String) { String methodName = (String)arguments[0]; try { dmd.GetSqlCommand(methodName); } catch (MethodNotFoundRuntimeException ignored) { // Do nothing! if (IsLogEnabled()) { Log("Not Found the method: " + methodName + " msg=" + ignored.Message); } } return; } else { String msg = "The method should have one string argument as method name: " + invocation; throw new SystemException(msg); } } }