Read-Only Root Collection with Read-Only Child Collection

Read-Only Root Collection with Read-Only Child Collection

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


superkuton posted on Saturday, June 12, 2010

Is it possible to have a Read-Only Root Collection with Read-Only Child Collection?

 

I want to provide a UI search facility where the user can search for account names using wild cards (i.e. those with 'Santos' as Last Name).

 

The UI will show a DataRepeater with the matching Customer Names (Read-Only Root Collection). Each Customer Name will have their own DataGridView showing the Purchases (Read-Only Child Collection) of the respective customer.

 

If this is possible, can you please help me with a simple example? Thank you.

Marjon1 replied on Saturday, June 12, 2010

I don't understand why you want this object to be a root object, why cannot this just be a standard ROL?
If saving is important, then what would be wrong with a BLB with a BB that contains only read-only properties?

Can the user ever save the collection, based on what I interpret it appears to be only for viewing. You could either have a factory that passes in the search criteria or if you have already fetched the objects could be filtered using either LINQ / FilteredBindingList depending on your preference in the UI.

Please correct me if I am missing something? 

superkuton replied on Saturday, June 12, 2010

Yes, I want a Read-Only List/Collection, so saving is unnecessary.

 

I want to display a list of Read-Only Parent List, each with a Read-Only Child List. In a DataRepeater control, the parent will be displayed in textboxes, while the children will be displayed in a datagridview.

 

Please help me with some samples. Thank you.

 

ajj3085 replied on Tuesday, June 15, 2010

Is this what you want?

public sealed class CustomerList : ReadOnlyListBase<CustomerList, CustomerInfo> {  public static CustomerList GetCustomers(object criteria ); }

public sealed class CustomerInfo : ReadOnlyBase<CustomerInfo> {  internal static CustomerInfo GetCustomer(object custData); }

public sealed class PurchasesList : ReadOnlyListBase<PurchasesList, PurchaseInfo> { }

public sealed class PurchaseInfo : ReadOnlyBase<PurchaseInfo> { }

 

superkuton replied on Tuesday, June 15, 2010

Andy,

 

yes, i want the business objects.

i want to implement the customerlist as the parent list, with each of the customer having a child collection of purchases list.

 

can you please help me some samples?

 

thank you.

tiago replied on Sunday, June 13, 2010

Hi,

You have a Summary of Csla 3.5 stereotypes with the possible relations here http://forums.lhotka.net/forums/p/7631/36450.aspx#36450

You have a series of articles and a sample project Make a Master/Detail DGV using CSLA DynamicRootList here http://www.codeproject.com/KB/cs/CslaERLB1.aspx

Copyright (c) Marimer LLC