Database ExtensionsTo Tracking Binding ListTEntity Method
This converts an enumerable list of change tracking entities to a binding list that will notify the
related data context of additions, changes, and deletions. The returned list is suitable for binding
to Windows Forms controls.
Definition
Namespace: EWSoftware.EntityFramework
Assembly: EWSoftware.EntityFramework (in EWSoftware.EntityFramework.dll) Version: 2025.11.12.0
A TrackingBindingListTEntity instance
Assembly: EWSoftware.EntityFramework (in EWSoftware.EntityFramework.dll) Version: 2025.11.12.0
C#
public static TrackingBindingList<TEntity> ToTrackingBindingList<TEntity>(
this IEnumerable<TEntity> entities,
DbContext dataContext
)
where TEntity : class, INotifyPropertyChanged
VB
<ExtensionAttribute>
Public Shared Function ToTrackingBindingList(Of TEntity As {Class, INotifyPropertyChanged}) (
entities As IEnumerable(Of TEntity),
dataContext As DbContext
) As TrackingBindingList(Of TEntity)C++
public:
[ExtensionAttribute]
generic<typename TEntity>
where TEntity : ref class, INotifyPropertyChanged
static TrackingBindingList<TEntity>^ ToTrackingBindingList(
IEnumerable<TEntity>^ entities,
DbContext^ dataContext
)F#
[<ExtensionAttribute>]
static member ToTrackingBindingList :
entities : IEnumerable<'TEntity> *
dataContext : DbContext -> TrackingBindingList<'TEntity> when 'TEntity : not struct and INotifyPropertyChangedParameters
- entities IEnumerableTEntity
- An enumerable list of the entities
- dataContext DbContext
- The data context that is tracking the items
Type Parameters
- TEntity
- The entity type
Return Value
TrackingBindingListTEntityA TrackingBindingListTEntity instance
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableTEntity. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Example
C#
using var dataContext = new MyDbContext();
bsAccounts.DataSource = dc.LoadAll<Account>().ToTrackingBindingList(dataContext);