How to prevent the use of Public Sub Add in BusinessListBase

How to prevent the use of Public Sub Add in BusinessListBase

Old forum URL: forums.lhotka.net/forums/t/3989.aspx


correodemarques posted on Wednesday, December 05, 2007

Hi, I have a collection of child objects (inherits from BusinessListBase), but I want to make the Add method of that collection Friend in scope. How can I prevent the UI from use Public Sub Add(item of T) that BusinessListBase inherits from Collection(of T)?

Why I need this?

I have a form with two lists, one with Roles granted to a user, and another one with the Roles not granted to a user. Between the list are two buttons "< Add Role" and "Remove Role>". When you clic the buttons, the selected roles in the list go from one list to the other.

In the library that is represented by a parent object with two collection of child objects. When the parent object is created, the collection of not granted roles is filled in the Dataportal_Create. The parent object has two methods: AddRole and RemoveRole. From that methods, (when I have to pass a Role from one list to the other) I want to call a Friend method Add in the collection, with the data of the role been moved. I have something like this working with CSLA 1.1

Well, that´s all. I hope somebody can read this.

Sorry for my english :-)

Troncho replied on Saturday, December 01, 2012

On your constructed class (from BusinessListBase), override InsertItem(..) and RemoveItem(..).

Troncho

Copyright (c) Marimer LLC