In the ProjectResource class you have a property Role. This is the property Id of the object Role.
Why you don’t use a reference to the object Role.
Suppose the GUI is changing the role with the combobox. Now the class ProjectResource knows only about the id of role, and not for example the name of the role.
Has somebody any idea?
The purpose I'm asking this, is for implementing the ErrorTreeView control from codeplex. I do not want to see id's, I want to override ToString and show something meaningfull to the user and not showing id's.
To explain the need in my case. I've the following objects:
Model: Editable Root Parent with a property Name(e.g. Shoe123)
ModelColors: EditableChildList
ModelColor: EditableChild with properties Id, ColorId, Quantity
Colors: EditableRoot List
Color: EditableSwitchable
So in the GUI we can create/update a model, we can change the name of the model,
and in a grid we can add all the possible colors in which this model is manufactured.
Now I was playing with the ErrorTreeView control from CSLAContrib to show all the business roles which are broken.
So I want to see something like:
Model : Shoe12
-Colors
-Color: Brown
- Quantity can not be negative
-Color: Yellow
- Quantity can not be more then 100
And not something with an id for the color
Model : Shoe12
-Colors
-Color: 45
- Quantity can not be negative
-Color: 67
- Quantity can not be more then 100
So in the Business Object ModelColor I need to override the ToString method to show the name of the color. But in ModelColor I do not have the name of the Color, I only have ColorId.
So how can I solve this? Not using ColorId in the business object ModelColor but storing a reference to the object Color? I don’t want to use code like Kleur.GetKleur(_colorId) because this invokes a roundtrip to the database.
Rocky, can you help me with this?
Copyright (c) Marimer LLC