void ReadListIntoBizo(BusinessObject bizo, XmlNode childNode, PropertyInfo matchingProperty)
        {
            var list               = (IList)matchingProperty.GetValue(bizo);
            var listType           = GetGenericTypeArgument(list.GetType());
            var listBaseMemberName = listType.Name;

            foreach (XmlNode node in childNode.ChildNodes)
            {
                if (typeof(BusinessObject).IsAssignableFrom(listType))
                {
                    var key  = GetKeyNode(node);
                    var item = BizoCreator.Create(listType, key.InnerText, bizo);
                    PopulateBusinessObject(item, node);

                    if (!list.Contains(item))
                    {
                        list.Add(item);
                    }
                }
                else
                {
                    var item = CastFromStringHelper.GetValueForPropertyTypeFromString(listBaseMemberName, node.InnerText);
                    list.Add(item);
                }
            }
        }
Exemple #2
0
        // Gets any matching bizo otherwise creates a new one
        public static T Get <T>() where T : BusinessObject
        {
            var existingBizo = ReadFirstWithCache <T>();

            if (existingBizo != null)
            {
                return(existingBizo);
            }

            return((T)BizoCreator.Create(typeof(T)));
        }
Exemple #3
0
 public static VUnit New(UnitType type, VLoadout loadout)
 {
     return((VUnit)BizoCreator.Create(typeof(VUnit), "Unit", loadout, type));
 }
Exemple #4
0
        // Creates New Business Object
        public static T NewWithoutCache <T>() where T : BusinessObject
        {
            var bizo = (T)BizoCreator.Create(typeof(T));

            return(bizo);
        }