//--------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner jhutson // @backupOwner jeffders //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.ComponentModel; namespace System.Data.Objects { /// /// Defines the behavior required for objects that maintain a binding list exposed by ObjectView. /// /// /// The type of elements in the binding list. /// internal interface IObjectViewData { /// /// Get the binding list maintained by an instance of IObjectViewData. /// IList List { get; } /// /// Get boolean that specifies whether newly-created items can be added to the binding list. /// /// /// True if newly-created items can be added to the binding list; otherwise false. /// bool AllowNew { get; } /// /// Get boolean that specifies whether properties of elements in the binding list can be modified. /// /// /// True if elements can be edited; otherwise false. /// bool AllowEdit { get; } /// /// Get boolean that specifies whether elements can be removed from the binding list. /// /// /// True if elements can be removed from the binding list; otherwise false. /// bool AllowRemove { get; } /// /// Get boolean that specifies whether the IObjectViewData instance implicitly fires list changed events /// when items are added to the binding list. /// /// /// True if the IObjectViewData instance fires list changed events on add; otherwise false. /// /// /// List changed events are fired by the ObjectContext if the IObjectViewData.OnCollectionChanged /// method returns a non-null ListChangedEventArgs object. /// bool FiresEventOnAdd { get; } /// /// Get boolean that specifies whether the IObjectViewData instance implicitly fires list changed events /// when items are removed from the binding list. /// /// /// True if the IObjectViewData instance fires list changed events on remove; otherwise false. /// /// /// List changed events are fired by the ObjectContext if the IObjectViewData.OnCollectionChanged /// method returns a non-null ListChangedEventArgs object. /// bool FiresEventOnRemove { get; } /// /// Get boolean that specifies whether the IObjectViewData instance implicitly fires list changed events /// when all items are cleared from the binding list. /// /// /// True if the IObjectViewData instance fires list changed events on clear; otherwise false. /// /// /// List changed events are fired by the ObjectContext if the IObjectViewData.OnCollectionChanged /// method returns a non-null ListChangedEventArgs object. /// bool FiresEventOnClear { get; } /// /// Throw an exception if the IObjectViewData instance does not allow newly-created items to be added to this list. /// void EnsureCanAddNew(); /// /// Add an item to the binding list. /// /// /// Item to be added. /// The value of this parameter will never be null, /// and the item is guaranteed to not already exist in the binding list. /// /// /// True if this method is being called as part of a IBindingList.AddNew operation; /// otherwise false. /// /// /// Index of added item in the binding list. /// /// /// If is true, /// the item should only be added to the list returned by the List property, and not any underlying collection. /// Otherwise, the item should be added to the binding list as well as any underlying collection. /// int Add(T item, bool isAddNew); /// /// Add the item in the binding list at the specified index to any underlying collection. /// /// /// Index of the item in the binding list. /// The index is guaranteed to be valid for the binding list. /// void CommitItemAt(int index); /// /// Clear all of the items in the binding list, as well as in the underlying collection. /// void Clear(); /// /// Remove an item from the binding list. /// /// /// Item to be removed. /// The value of this parameter will never be null. /// The item does not have to exist in the binding list. /// /// /// True if this method is being called as part of a ICancelAddNew.CancelNew operation; /// otherwise false. /// /// /// True if item was removed from list; otherwise false if item was not present in the binding list. /// /// /// If is true, /// the item should only be removed from the binding list, and not any underlying collection. /// Otherwise, the item should be removed from the binding list as well as any underlying collection. /// bool Remove(T item, bool isCancelNew); /// /// Handle change to underlying collection. /// /// The source of the event. /// /// Event arguments that specify the type of modification and the associated item. /// /// /// Object used to register or unregister individual item notifications. /// /// /// ListChangedEventArgs that provides details of how the binding list was changed, /// or null if no change to binding list occurred. /// The ObjectView will fire a list changed event if this method returns a non-null value. /// /// /// The listener.RegisterEntityEvent method should be called for items added to the binding list, /// and the listener.UnregisterEntityEvents method should be called for items removed from the binding list. /// Other methods of the ObjectViewListener should not be used. /// ListChangedEventArgs OnCollectionChanged(object sender, CollectionChangeEventArgs e, ObjectViewListener listener); } }