DABindingList Class

From RemObjects Wiki

Jump to:navigation, search
.NET Platform Header-48.png

This is a Data Abstract for .NET Library topic

Please do not modify the page structure, but feel free to modify/add text.

ClassesProtocolsEnums

Contents

Overview

The DABindingList class represents the generic collection that supports data binding. The DABindingList class can be bound with datagrid or any other control.
For example:

var lQuery = from emp in linqRemoteDataAdapter.GetTable<Worker>() 
               select emp;
grid.DataSource = lQuery.ToDABindingList();

This code gets the resultset from the Worker class generated by Linq and binds this resultset with the grid data source.

The DABindingList class also performs automatic tracking of changes in the remote table. To apply changes on the server, the ApplyChanges method can be used.

For creating a new DABindingList instance, we recommend using the ToDABindingList extension method of the BindingListExtensions class.

An example for the usage of the DABindingList class can be found in the DA sample DA LINQ.

Location


Properties

IgnoreChange   protected

If this property equals true, it ignores all changes with items of the current DABindingList collection, otherwise it applies them.


Prism:   property IgnoreChange: Boolean read write
C#:   Boolean IgnoreChange { get; set; }
VB:   Property IgnoreChange As Boolean

Merging   protected

This property is not used at the moment, but will be in the future.


Prism:   property Merging: Boolean read write
C#:   Boolean Merging { get; set; }
VB:   Property Merging As Boolean

ResetThreshold


Prism:   property ResetThreshold: Int32 read write
C#:   Int32 ResetThreshold { get; set; }
VB:   Property ResetThreshold As Int32


Instance Methods

constructor (LinqRemoteDataAdapter)

Creates a new DABindingList object with the specified LinqRemoteDataAdapter object. This constructor hooks the table with the type T from the LinqRemoteDataAdapter with the current DABindingList object. T is the class that represents the Linq generated class.

For example:
DABindingList<Worker> BindingList1 = new DABindingList<Worker>(linqRemoteDataAdapter);
creates an object BindingList1, which is hooked with the table of the type Worker from the linqRemoteDataAdapter.


Prism:   constructor(aRemoteDataAdapter: LinqRemoteDataAdapter)
C#:   constructor(LinqRemoteDataAdapter aRemoteDataAdapter)
VB:   Sub New (aRemoteDataAdapter As LinqRemoteDataAdapter)


Parameters:

  • aRemoteDataAdapter: Specified remote data adapter with remote table.


constructor (RemoteTable<T>)

Creates a binding list for the given remote table aTable.


Prism:   constructor(aTable: RemoteTable<T>)
C#:   constructor(RemoteTable<T> aTable)
VB:   Sub New (aTable As RemoteTable<T>)


Parameters:

  • aTable: Specified remote table.


ClearItems     protected


Prism:   method ClearItems
C#:   void ClearItems()
VB:   Sub ClearItems

DoEnqueueChange     protected

This protected method registers and tracks changes that the user made inside the binding list.


Prism:   method DoEnqueueChange(anItem: T; aField: String; aCurrentChange: ChangeType)
C#:   void DoEnqueueChange(T anItem, String aField, ChangeType aCurrentChange)
VB:   Sub DoEnqueueChange(anItem As T, aField As String, aCurrentChange As ChangeType)


Parameters:

  • anItem: The changed row in the remote table.
  • aField: The changed field in the anItem row.
  • aCurrentChange: The change inside the aField (insert, delete, update).


FindMatchingRecord     protected


Prism:   method FindMatchingRecord(aOther: T): Int32
C#:   Int32 FindMatchingRecord(T aOther)
VB:   Function FindMatchingRecord(aOther As T) As Int32


Parameters:

  • aOther:


InsertItem     protected

Inserts a new item into the current DABindingList list. Before insertion, it invokes the SetIdenties method, which sets the new identity for the new item. The new identity will be set only for fields of the types datAutoInc and datLargeAutoInc. If the binding remote table doesn't have autoinc fields, no identity will be set.


Prism:   method InsertItem(index: Int32; item: T)
C#:   void InsertItem(Int32 index, T item)
VB:   Sub InsertItem(index As Int32, item As T)


Parameters:

  • index: Specified index.
  • item: New item in the DABindingList collection.


MergeRecord


Prism:   method MergeRecord(rec: T)
C#:   void MergeRecord(T rec)
VB:   Sub MergeRecord(rec As T)


Parameters:

  • rec:


MergeRecords


Prism:   method MergeRecords(rec: array of T)
C#:   void MergeRecords(array of T rec)
VB:   Sub MergeRecords(rec As array of T)


Parameters:

  • rec:


MonoAddNotify     protected


Prism:   method MonoAddNotify(o: Object)
C#:   void MonoAddNotify(Object o)
VB:   Sub MonoAddNotify(o As Object)


Parameters:

  • o:


MonoRemoveNotify     protected


Prism:   method MonoRemoveNotify(o: Object)
C#:   void MonoRemoveNotify(Object o)
VB:   Sub MonoRemoveNotify(o As Object)


Parameters:

  • o:


NotifyAction     protected

Protected specific method that handles insert and delete changes within the remote table. The NotifyAction method delegates the processing of the given change to the DoEnqueueChange method, which is more common.
You don't need to deal with this method directly. It is called automatically after an insert or delete action was performed inside the DABindingList class.


Prism:   method NotifyAction(anItem: T; aChange: ChangeType)
C#:   void NotifyAction(T anItem, ChangeType aChange)
VB:   Sub NotifyAction(anItem As T, aChange As ChangeType)


Parameters:

  • anItem: The changed row in the remote table.
  • aChange: The change inside the aField (insert, delete, update).


OnListChanged

Raises the ListChanged event, which occurs when the list or an item in the list changes. The DABindingList class overrides this method and adds functions that add and/or update the item in the binding remote table.


Prism:   method OnListChanged(e: ListChangedEventArgs)
C#:   void OnListChanged(ListChangedEventArgs e)
VB:   Sub OnListChanged(e As ListChangedEventArgs)


Parameters:

  • e: Contains the complete information about changed items.


RemoveItem     protected

Removes the item with the specified index anIndex from the binding remote table. This method is virtual, so you can override it in the descendant classes and realize the specified method, which will remove the item from the custom collection.


Prism:   method RemoveItem(anIndex: Int32)
C#:   void RemoveItem(Int32 anIndex)
VB:   Sub RemoveItem(anIndex As Int32)


Parameters:

  • anIndex: The index of the deleted item.


ResetChanges

Resets all changes from the current DABindingList object. This method removes all the changes from the binding remote table.


Prism:   method ResetChanges
C#:   void ResetChanges()
VB:   Sub ResetChanges


SaveChanges

Empty method.


Prism:   method SaveChanges(rda: LinqRemoteDataAdapter)
C#:   void SaveChanges(LinqRemoteDataAdapter rda)
VB:   Sub SaveChanges(rda As LinqRemoteDataAdapter)


Parameters:

  • rda: Specified LINQ remote data adapter.


SetIdenties

Sets a new temporary identity for the item anItem. This method is used before the insertion of a new item into the binding remote table. The first insert item will be given the temporary ID = -1, the second -2, etc. These negative IDs will be used later during the merging of the data that comes back from the server.


Prism:   method SetIdenties(anItem: T)
C#:   void SetIdenties(T anItem)
VB:   Sub SetIdenties(anItem As T)


Parameters:

  • anItem: Specified row in the binding remote table.


SetItem     protected


Prism:   method SetItem(index: Int32; item: T)
C#:   void SetItem(Int32 index, T item)
VB:   Sub SetItem(index As Int32, item As T)


Parameters:

  • index:
  • item:



See Also


Da-48.png

Product: RemObjects Data Abstract
Available Editions: Data Abstract for .NET, Delphi and Xcode

GlossaryArchitectureArticlesFeaturesLibrarySamples

Navigation
products
hubs
special
Toolbox