views:

219

answers:

2

hi everyone, i'm an asp.net/c# developer and i've been working on this area since 2 years. I recently entered in a new asp.net project where the guy who created the enterprise architecture is quite absent. Because of this situation i'm trying to understand pros n cons of some unusual decision.

Most of all, i noticed that he created a business layer where every object is, at real time, a collection of object.

public class User : List < User > {}

Even I know that I should ask these questions to the one who created this structured, but i'd like to know if someone could tell me the pros of defining an object as collection in business layer.

thanks

+2  A: 

Without any other context I will at least say that modeling business entities (as the User class probably is an example of) should be modeled using object oriented patterns. A User in my world represents one person in a system, and is thus in itself seldom a collection of users. Therefore letting the User class inherit a list of users makes no sense to me.

Peter Lillevold
thx peter, i appreciate your answer so much.I'm used to create my object [in business layer] thinking about them singularly. The list inheritance makes no sense to mee too.
frabiacca
Glad to be of assistance :) The great thing with object oriented modeling is that common sense applies..
Peter Lillevold
A: 

What if you want to return a collection of users to the UI. Say, you want to bind it to a gridview using this generic list.

something like..

public class UsersList : List < User > {}

regards,

suresh manakal
i do not understand what u mean when u say 'What if you want to return a collection of users to the UI'. Actually, i usually see at the business layer as a set of single object. Then, if i need to bind a list to a gridview, i'll create a method which returns a List<MyObject>
frabiacca