src/Misc/EFTools/XmlCore/Base/Context/EditingContext.cs
/// <summary>
///     Returns an instance of the requested item type.  If there is no context
///     item with the given type, an empty item will be created.
/// </summary>
Returns an instance of the requested item type.  If there is no context
item with the given type, an empty item will be created.
Returns an instance of the requested item type . If there is no context item with the given type an empty item will be created .
internal override ContextItem GetValue(Type itemType)
            {
                var item = GetValueNull(itemType);
                if (item == null)
                {
                    if (!_currentLayer.DefaultItems.TryGetValue(itemType, out item))
                    {
                        item = (ContextItem)Activator.CreateInstance(itemType);
                        if (item.ItemType != itemType)
                        {
                            throw new ArgumentException("Error in DerivedContextItem", itemType.FullName);
                        }
                        _currentLayer.DefaultItems.Add(item.ItemType, item);
                    }
                }
                return item;
            }
internal override ContextItem GetValue ( Type itemType ) { var item = GetValueNull ( itemType ) ; if ( item == null ) { if ( ! _currentLayer . DefaultItems . TryGetValue ( itemType , out item ) ) { item = ( ContextItem ) Activator . CreateInstance ( itemType ) ; if ( item . ItemType != itemType ) { throw new ArgumentException ( " " , itemType . FullName ) ; } _currentLayer . DefaultItems . Add ( item . ItemType , item ) ; } } return item ; }
Returns an instance of the requested item type.
Returns an instance of the requested item type .
// Check the default item table and add a new // instance there if we need to // Verify that the resulting item has the correct item type // If it doesn't, it means that the user provided a derived // item type /*
                            throw new ArgumentException(string.Format(
                                CultureInfo.CurrentCulture, 
                                Resources.Error_DerivedContextItem,
                                itemType.FullName,
                                item.ItemType.FullName));
                            */ // Now push the item in the context so we have // a consistent reference
itemType
Type