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); } } }
// 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))); }
public static VUnit New(UnitType type, VLoadout loadout) { return((VUnit)BizoCreator.Create(typeof(VUnit), "Unit", loadout, type)); }
// Creates New Business Object public static T NewWithoutCache <T>() where T : BusinessObject { var bizo = (T)BizoCreator.Create(typeof(T)); return(bizo); }