//------------------------------------------------------------------------------------ /// <summary> /// Ensure that the given property is present in the in-memory cache - if not, the /// property is populated with its initial value from the backing store (or with a /// default empty value if the item is not a persisted type). /// </summary> //------------------------------------------------------------------------------------ private ItemProperty EnsureItemProperty(string dsPropName, string publicPropName, PropType type) { if (publicPropName == null) { throw new ApplicationException(); } ItemProperty itemProperty = null; lock (SyncLockItemProperties) { if (!ItemProperties.TryGetValue(publicPropName, out itemProperty)) { itemProperty = new ItemProperty(this, dsPropName, publicPropName, type); if (IsPersisted) { itemProperty.ReadFromStore(); } ItemProperties.Add(publicPropName, itemProperty); } } return(itemProperty); }