Exemple #1
0
        public static object GetValue(BusinessObject obj, PropertyInfo proInfo)
        {
            string key = obj.AATableName + proInfo.Name;

            try
            {
                GetHandler getHandler = null;
                if (lstGetHandler.TryGetValue(key, out getHandler) == false)
                {
                    getHandler = ABCDynamicMethodCompiler.CreateGetHandler(obj.GetType(), proInfo);
                    lstGetHandler.Add(key, getHandler);
                }
                return(getHandler(obj));
            }
            catch (System.Exception ex)
            {
                return(proInfo.GetValue(obj, null));
            }
        }
Exemple #2
0
        public static object GetValue(BusinessObject obj, String strColName)
        {
            if (obj == null)
            {
                return(null);
            }

            string key = obj.AATableName + strColName;

            try
            {
                GetHandler getHandler = null;
                if (lstGetHandler.TryGetValue(key, out getHandler) == false)
                {
                    Type type = obj.GetType();

                    PropertyInfo proInfo = BusinessObjectHelper.GetProperty(obj.AATableName, strColName);
                    if (proInfo == null)
                    {
                        proInfo = type.GetProperty(strColName);
                    }

                    getHandler = ABCDynamicMethodCompiler.CreateGetHandler(type, proInfo);
                    lstGetHandler.Add(key, getHandler);
                }

                return(getHandler(obj));
            }
            catch (System.Exception ex)
            {
                PropertyInfo proInfo = obj.GetType().GetProperty(strColName);
                if (proInfo == null)
                {
                    //    Utilities.ABCLogging.LogNewMessage( "ABCDataLib" , "" , "GetValue" , obj.GetType().Name+" not contain "+strColName , "FAILE" );
                    return(null);
                }

                return(proInfo.GetValue(obj, null));
            }
        }