Class Design question

  • Thread starter Thread starter Will
  • Start date Start date
W

Will

We use Public properties in our business classes to represent field
values from databases. So in Vb, I might have something like:

Public Property Emp_Id() As System.Decimal
Get
Return _Emp_Id
End Get
Set(ByVal value As System.Decimal)
_Emp_Id = value
End Set
End Property

So now it's easy enough for some code to create an instance of the
class and get or set the value. But I'd like to be able to get the
friendly name of a field, like a data dictionary. The business object
should be able to provide this friendly name to a form for example to
use as a label or maybe a grid column heading.

In my example above, I can reference Emp_Id like this:

Employee.Emp_Id

What I'd like to be able to do is create a way for me to store the
friendly name in the business class and access it in a similar way
like this perhaps:

Employee.Emp_Id.FriendlyName

Any ideas?
 
An aggregate type (one that has more than one field or property) is either
going to be a structure or a class. So, you need to create a structure or a
class, rather than using a System.Decimal. For example, you could use a
structure that has a System.Decimal member and a string member.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.
 
Back
Top