示例#1
0
        /// <summary>
        /// Prebacuje vrednost iz atributa u propertije - u skladu sa podesenim mapiranjem (imbAttributeName.metaValueFromAttribute)
        /// </summary>
        /// <param name="target">Objekat ciji se propertiji podesavaju</param>
        /// <param name="attribs">Atributi iz kojih izvlaci vrednost</param>
        /// <param name="onlyDeclared">Da li samo propertije target klase ili i nasledjene propertije</param>
        /// <param name="avoidOverWrite">Da li da preskoci ako Property vec ima vrednost</param>
        public static void imbAttributeToProperties(this Object target, imbAttributeCollection attribs,
                                                    Boolean onlyDeclared = false, Boolean avoidOverWrite = false)
        {
            if (target == null)
            {
                //  logSystem.log("Target object not supplied", logType.FatalError);
                return;
            }

            if (attribs == null)
            {
                //logSystem.log("Attributes to write values not supplied", logType.FatalError);
                return;
            }

            imbAttributeToPropertyMap map = getImbAttributeMap(target.GetType());

            map.writeToObject(target, attribs, onlyDeclared, avoidOverWrite);
        }
示例#2
0
        /// <summary>
        /// Vraca ili kreira novu Attribute mapu
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public static imbAttributeToPropertyMap getImbAttributeMap(this Type input)
        {
            imbAttributeToPropertyMap output = null;

            if (imbAttributeProfileEngine.attributeToPropertyMapsByType.ContainsKey(input))
            {
                if (logNotificationsHere)
                {
                    // logSystem.log("Attribute map for :: " + input.Name + " found in cache", logType.Notification);
                    return(imbAttributeProfileEngine.attributeToPropertyMapsByType[input]);
                }
            }
            output = new imbAttributeToPropertyMap(input);
            if (!imbAttributeProfileEngine.attributeToPropertyMapsByType.ContainsKey(input))
            {
                imbAttributeProfileEngine.attributeToPropertyMapsByType.Add(input, output);
            }

            return(output);
        }