IdeaBlade DevForce 2010 Help Reference
ManageList Method
See Also  Example Send Feedback
IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > EntityListManager<T> Class : ManageList Method



list
shouldRefresh
Adds a list to the set of those managed by this EntityListManager and optionally refreshes the list

Syntax

Visual Basic (Declaration) 
Public Sub ManageList( _
   ByVal list As IList, _
   ByVal shouldRefresh As Boolean _
) 
Visual Basic (Usage)Copy Code
Dim instance As EntityListManager(Of T)
Dim list As IList
Dim shouldRefresh As Boolean
 
instance.ManageList(list, shouldRefresh)
C# 
public void ManageList( 
   IList list,
   bool shouldRefresh
)
C++/CLI 
public:
void ManageList( 
   IList^ list,
   bool shouldRefresh
) 

Parameters

list
shouldRefresh

Example

C#Copy Code
// Example showing how a List<T> can be managed as a live list.
  public void EntityListManagerSample() {

  DomainModelEntityManager mgr = new DomainModelEntityManager();
  
  // Retrieve a customer and employee.
  var customer = mgr.Customers.FirstOrDefault(c => c.Id == 1);
  var employee = mgr.Employees.FirstOrDefault(e => e.Id == 1);

  // Load a List with customer's order summaries.
  var list = new List<OrderSummary>(customer.OrderSummaries);
  int orderCount = list.Count;

  // We want to watch for any new orders for this customer.
  // We can't "watch" the NavigationEntityProperty, so watch its FK. 
  var prop = OrderSummary.Customer_fk_IdEntityProperty;

  // Set up the manager.
  IListManager manager = new EntityListManager<OrderSummary>(mgr,
          os => os.Customer == customer,   // filter 
          new[] { prop },                  // watch
          list,                            // list to be managed
          false);                          // refresh now 

  // Create a new order - the list count should increment.
  OrderSummary aOrder = mgr.CreateEntity<OrderSummary>();
  aOrder.Employee = employee;
  aOrder.Customer = customer;
  aOrder.AddToManager();
 
  Assert.IsTrue(list.Count == orderCount + 1);

  // Now delete this order - the list count should decrement.
  aOrder.EntityAspect.Delete();
  Assert.IsTrue(list.Count == orderCount);
}
Visual BasicCopy Code

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.