Print Page | Close Window

Converting ReadOnlyEntityList to EntityList question

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=908
Printed Date: 25-Mar-2025 at 10:09pm


Topic: Converting ReadOnlyEntityList to EntityList question
Posted By: yongbum75
Subject: Converting ReadOnlyEntityList to EntityList question
Date Posted: 09-Aug-2008 at 8:42am

I found the following tech tip but am not 100% clear on what you mean by "Note that your new list is an unmanaged one (unless and until you configure a ListManager for it), so no additional Order objects will get into it unless you expressly put them there."

Can you give me a code example that shows how to "configure a  ListManager for it"?

Thanks!


Converting a ReadOnlyEntityList<T> Into an EntityList<T>

On occasion you may want to convert your ReadOnlyEntityList<T> into a list to which you can directly add or remove entities. You can do that easily, as follows:
 

C#:

EntityList<Order> orders =
  new EntityList<Order>(mCurrentEmployee.Orders);


VB.NET:

Dim orders As EntityList(Of Order) = _
  New EntityList(Of Order)(mCurrentEmployee.Orders)

Now you can add and remove Orders freely and directly in your new orders collection. Note that your new list is an unmanaged one (unless and until you configure a ListManager for it), so no additional Order objects will get into it unless you expressly put them there.




Replies:
Posted By: GregD
Date Posted: 09-Aug-2008 at 9:02am
Yongbum75:
 
 
There is also a code solution, "EntityListManager", in the 200 Intermediate instructional unit on "BindableList".
 
Best regards,
Greg Dunn
IdeaBlade
 



Print Page | Close Window