G
Guest
The answer might be obvious, but I'm looking for inout on the following
scenario.
I have a class called Employee that looks like this:
Public Class Employee
Private _employeeId As Int16
Public Property Id As Int16
Get
blah, blah......
This class is mapped to an Employees table and empId maps to the table's
primary key.
I have another class called Attendance. It maps to a table called
Attendence, which has a foreign key (employeeId) to the Employees table.
In the Attendance class, I want to store the employeeId value I retrieved
from the Attendance table. Because the value is a simple one, I don't want to
instantiate a new Employee object for each Attendance object. However, I do
want to reinforce the same type in both classes.
The idea is to prevent coding incorrect types. If I were doing something
like this in SQL Server, I would consider a UDT. I'm looking for a similar
technique in .Net.
Would a Structure somehow fill this requirement? Is there some better
practice? Should I simply maintain a data dictionary somewhere and tape it to
the wall? I welcome your thoughts.
Barry
scenario.
I have a class called Employee that looks like this:
Public Class Employee
Private _employeeId As Int16
Public Property Id As Int16
Get
blah, blah......
This class is mapped to an Employees table and empId maps to the table's
primary key.
I have another class called Attendance. It maps to a table called
Attendence, which has a foreign key (employeeId) to the Employees table.
In the Attendance class, I want to store the employeeId value I retrieved
from the Attendance table. Because the value is a simple one, I don't want to
instantiate a new Employee object for each Attendance object. However, I do
want to reinforce the same type in both classes.
The idea is to prevent coding incorrect types. If I were doing something
like this in SQL Server, I would consider a UDT. I'm looking for a similar
technique in .Net.
Would a Structure somehow fill this requirement? Is there some better
practice? Should I simply maintain a data dictionary somewhere and tape it to
the wall? I welcome your thoughts.
Barry