// ===============================================================================
        //                                                                      Initialize
        //                                                                      ==========
        public void InitializeConditionBeanMetaData()
        {
            Map <String, DBMeta> dbmetaMap = DBMetaInstanceHandler.GetUnmodifiableDBMetaMap();
            Collection <DBMeta>  dbmetas   = dbmetaMap.values();
            DateTime?            before    = null;

            if (_log.IsInfoEnabled)
            {
                before = DateTime.Now;
                _log.Info("/= = = = = = = = = = = = = = = = = InitializeConditionBeanMetaData()");
            }
            foreach (DBMeta dbmeta in dbmetas)
            {
                DaoReadable dao    = DaoSelector.ByName(dbmeta.TableDbName);
                MethodInfo  method = dao.GetType().GetMethod("InitializeDaoMetaData");
                if (method == null)
                {
                    continue;
                }
                method.Invoke(dao, new Object[] { "SelectList" });
            }
            if (_log.IsInfoEnabled)
            {
                DateTime after = DateTime.Now;
                _log.Info("Initialized Count: " + dbmetas.size());
                _log.Info("= = = = = = = = = =/ [" + TraceViewUtil.ConvertToPerformanceView(before.Value, after) + "]");
            }
        }
Exemplo n.º 2
0
        // ===============================================================================
        //                                                                      Log Return
        //                                                                      ==========
        protected void LogReturn(IMethodInvocation invocation, Type retType, Object ret, DateTime before, DateTime after)
        {
            MethodBase method = invocation.Method;

            try {
                String daoResultPrefix = "===========/ [" + TraceViewUtil.ConvertToPerformanceView(before, after) + " ";
                if (typeof(System.Collections.IList).IsAssignableFrom(retType) || (ret != null && ret is System.Collections.IList))
                {
                    if (ret == null)
                    {
                        Log(daoResultPrefix + "(null)]");
                    }
                    else
                    {
                        System.Collections.IList ls = (System.Collections.IList)ret;
                        if (ls.Count == 0)
                        {
                            Log(daoResultPrefix + "(0)]");
                        }
                        else if (ls.Count == 1)
                        {
                            Log(daoResultPrefix + "(1) result=" + BuildResultString(ls[0]) + "]");
                        }
                        else
                        {
                            Log(daoResultPrefix + "(" + ls.Count + ") first=" + BuildResultString(ls[0]) + "]");
                        }
                    }
                }
                else if (typeof(Entity).IsAssignableFrom(retType))
                {
                    if (ret == null)
                    {
                        Log(daoResultPrefix + "(null)" + "]");
                    }
                    else
                    {
                        Entity entity = (Entity)ret;
                        Log(daoResultPrefix + "(1) result=" + BuildResultString(entity) + "]");
                    }
                }
                else
                {
                    Log(daoResultPrefix + "result=" + ret + "]");
                }
                Log(" ");
            } catch (Exception e) {
                String msg = "Result object debug threw the exception: methodName=" + method.Name + " retType=" + retType;
                msg = msg + " ret=" + ret;
                _log.Warn(msg, e);
                throw;
            }
        }
Exemplo n.º 3
0
 // ===============================================================================
 //                                                                  Log SqlCommand
 //                                                                  ==============
 protected void LogSqlCommand(IMethodInvocation invocation, ISqlCommand cmd, DateTime beforeCmd, DateTime afterCmd)
 {
     Log("SqlCommand Initialization Cost: [" + TraceViewUtil.ConvertToPerformanceView(beforeCmd, afterCmd) + "]");
 }