示例#1
0
 public void ClearReferences()
 {
     if (accessor.IsReference)
     {
         foreach (var item in items)
         {
             references.OnAssigningNull(item.Node, item.Value);
         }
     }
 }
示例#2
0
        protected void RemoveCollectionItems(IXmlNode parentNode, XmlReferenceManager references, object value)
        {
            var collection = value as ICollectionProjection;

            if (collection != null)
            {
                collection.Clear();
                return;
            }

            var itemType    = clrType.GetCollectionItemType();
            var accessor    = GetCollectionAccessor(itemType);
            var cursor      = accessor.SelectCollectionItems(parentNode, true);
            var isReference = IsReference;

            var items = value as IEnumerable;

            if (items != null)
            {
                foreach (var item in items)
                {
                    if (!cursor.MoveNext())
                    {
                        break;
                    }
                    if (isReference)
                    {
                        references.OnAssigningNull(cursor, item);
                    }
                }
            }

            cursor.Reset();
            cursor.RemoveAllNext();
        }
示例#3
0
        private void RemoveCore(int index)
        {
            EndNew(addedIndex);

            var item = items[index];

            DetachPropertyChanged(item.Value);
            if (accessor.IsReference)
            {
                references.OnAssigningNull(item.Node, item.Value);
            }

            cursor.MoveTo(item.Node);
            cursor.Remove();
            items.RemoveAt(index);

            NotifyListChanged(ListChangedType.ItemDeleted, index);
        }
示例#4
0
		protected void RemoveCollectionItems(IXmlNode parentNode, XmlReferenceManager references, object value)
		{
			var collection = value as ICollectionProjection;
			if (collection != null)
			{
				collection.Clear();
				return;
			}

			var itemType    = clrType.GetCollectionItemType();
			var accessor    = GetCollectionAccessor(itemType);
			var cursor      = accessor.SelectCollectionItems(parentNode, true);
			var isReference = IsReference;

			var items = value as IEnumerable;
			if (items != null)
			{
				foreach (var item in items)
				{
					if (!cursor.MoveNext())
						break;
					if (isReference)
						references.OnAssigningNull(cursor, item);
				}
			}

			cursor.Reset();
			cursor.RemoveAllNext();
		}