Code:
protected void OnPerformGetDbCount( object sender, PerformGetDbCountEventArgs2 e )
{
int dbCount = 0;
using( DataAccessAdapter adapter = new DataAccessAdapter() )
{
switch( e.DataContainerType )
{
case DataSourceDataContainerType.EntityCollection:
dbCount = adapter.GetDbCount( e.ContainedCollection, e.Filter );
break;
case DataSourceDataContainerType.TypedList:
dbCount = adapter.GetDbCount( e.Fields, e.Filter, null, e.AllowDuplicates );
break;
case DataSourceDataContainerType.TypedView:
dbCount = adapter.GetDbCount( e.Fields, e.Filter );
break;
}
}
e.DbCount = dbCount;
}
protected void OnPerformSelect( object sender, PerformSelectEventArgs2 e )
{
using( DataAccessAdapter adapter = new DataAccessAdapter() )
{
switch( e.DataContainerType )
{
case DataSourceDataContainerType.EntityCollection:
adapter.FetchEntityCollection( e.ContainedCollection, e.Filter, e.MaxNumberOfItemsToReturn, e.Sorter, e.PageNumber, e.PageSize );
break;
case DataSourceDataContainerType.TypedList:
adapter.FetchTypedList( e.Fields, (DataTable)e.ContainedTypedList, e.Filter, e.MaxNumberOfItemsToReturn, e.Sorter,
e.AllowDuplicates, null, e.PageNumber, e.PageSize );
break;
case DataSourceDataContainerType.TypedView:
adapter.FetchTypedView( e.Fields, (DataTable)e.ContainedTypedView, e.Filter, e.MaxNumberOfItemsToReturn, e.Sorter, e.AllowDuplicates, null,
e.PageNumber, e.PageSize );
break;
}
}
}
protected void llblgenDS2_PerformWork( object sender, PerformWorkEventArgs2 e )
{
using( DataAccessAdapter adapter = new DataAccessAdapter() )
{
e.Uow.Commit( adapter, true );
llblgenDS2.Refetch = true;
}
}
Rule of thumb: the event args of the particular event handler is the container of all the parameters to pass to the method you need to call in the generated code, e.g. the dataaccessadapter method to fetch an entitycollection for example