views:

107

answers:

2

I am starting to code a fresh domain model. I plan to use NHibernate to persist my classes later on.

I am building an application that is mainly used for optimising transportation. My domain model has one important class in in that is called Model, which represents the current situation that I want to optimize. It is basically a container for other containers (Vehicles, Locations, Jobs and such). I am thinking that inheriting the containers from BindingList<T> would make my life easier when binding the object to grids and such later on.

Do you think it is a good idea or has my approach some obvious loop holes ?

EDIT: Ok. Binding list may be too tied to the presentation layer. I

Is using List<T> such a problem as well ?

+1  A: 

I would not inherit my containers from BindingList.

If your concern is easy databinding in the presentation layer, why don't you use a BindingSource in the prestation-layer, and assign your collection to that BindingSource ?
You can - in the presentation layer- wrap your collection around a BindingList if necessary, and by doing so, you do not have to use a bindinglist in your domain model.

Frederik Gheysels
Thank you for your comments.
Tomas Pajonk
+1  A: 

You should create a presentation layer and if needed - use BindingList there.

Domain model does not care about persistance or how you are going to show data.

Arnis L.
Good points. Thanks.
Tomas Pajonk