DatabaseExtensionsToTrackingBindingListTEntity 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.
Namespace: EWSoftware.EntityFrameworkAssembly: EWSoftware.EntityFramework (in EWSoftware.EntityFramework.dll) Version: 2025.11.12.0
public static TrackingBindingList<TEntity> ToTrackingBindingList<TEntity>(
this IEnumerable<TEntity> entities,
DbContext dataContext
)
where TEntity : class, INotifyPropertyChanged
<ExtensionAttribute>
Public Shared Function ToTrackingBindingList(Of TEntity As {Class, INotifyPropertyChanged}) (
entities As IEnumerable(Of TEntity),
dataContext As DbContext
) As TrackingBindingList(Of TEntity)
public:
[ExtensionAttribute]
generic<typename TEntity>
where TEntity : ref class, INotifyPropertyChanged
static TrackingBindingList<TEntity>^ ToTrackingBindingList(
IEnumerable<TEntity>^ entities,
DbContext^ dataContext
)
[<ExtensionAttribute>]
static member ToTrackingBindingList :
entities : IEnumerable<'TEntity> *
dataContext : DbContext -> TrackingBindingList<'TEntity> when 'TEntity : not struct and INotifyPropertyChanged
- entities IEnumerableTEntity
- An enumerable list of the entities
- dataContext DbContext
- The data context that is tracking the items
- TEntity
- The entity type
TrackingBindingListTEntityA
TrackingBindingListTEntity instanceIn 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).
using var dataContext = new MyDbContext();
bsAccounts.DataSource = dc.LoadAll<Account>().ToTrackingBindingList(dataContext);