whether a dictionary property for data holder business object is goodor not?

G

giddy

hi,

yet another design question, this one is more simple and maybe a
little silly.

When it comes to classes like

class Person{
string Name;
string Address;
int Age;
....
}

They have a bunch of data holding properties, and properties that
could change over time, I read somewhere that a dictionary would be a
good thing to replace properties like this, so would a dictionary be
better?
A bad thing would be that properties would turn out to be strings! Is
that ok?

More importantly, would this help me bind my properties easily when it
comes to making long annoying forms with a control for each property
that must be validated. Is there a good design to automate
validation,updating the right property in the business object and
saving it.


Thanks so much

Gideon
 
I

Ignacio Machin ( .NET/ C# MVP )

hi,

yet another design question, this one is more simple and maybe a
little silly.

When it comes to classes like

class Person{
string Name;
string Address;
int Age;
....

}

They have a bunch of data holding properties, and properties that
could change over time, I read somewhere that a dictionary would be a
good thing to replace properties like this, so would a dictionary be
better?
A bad thing would be that properties would turn out to be strings! Is
that ok?

More importantly, would this help me bind my properties easily when it
comes to making long annoying forms with a control for each property
that must be validated. Is there a good design to automate
validation,updating the right property in the business object and
saving it.

Thanks so much

Gideon

If they are replaced very often yes, a dictionary is a good idea.

I find weird though that a class Person change that often, it might
indicate a bad design
 
G

giddy

If they are replaced very often yes, a dictionary is a good idea.

I find weird though that a class Person change that often, it might
indicate a bad design

hmm, but there are properties like
PuposeOfVisit, Country of Birth, State Of Birth, and a bunch of other
details that the marketing guys could maybe benefit from??

But more or less they're all just "Data" about the user more than
properties.

Thanks
Gideon
 
I

Ignacio Machin ( .NET/ C# MVP )

hmm, but there are properties like
PuposeOfVisit, Country of Birth, State Of Birth, and a bunch of other
details that the marketing guys could maybe benefit from??

But more or less they're all just "Data" about the user more than
properties.

Thanks
Gideon

our system has something like that, user Defined Fields. Basically
they are stored and treated as a dictionary.
As you saw it's more challanged to create a form to display them. you
have to design he form to allow it to have an unknown number of fields.
 
J

Jeff Johnson

message
our system has something like that, user Defined Fields. Basically
they are stored and treated as a dictionary.
As you saw it's more challanged to create a form to display them. you
have to design he form to allow it to have an unknown number of fields.

Grids are very handy for that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top