G
Graham Pengelly
Hi
I'll try to spell out my problem as succinctly as possible...
My database has a User table, an Organisation table, a Department table
and a JobType table (amongst others)
The Organisation table has a one to many relationship with the other
three. The User table contains foreign keys to the Department and
JobType tables (and the Organisation table).
I want to build User, Organisation, Department and JobType objects
reflecting the data that I can fill from a SqlDataReader. How should I
best include the relationships in the objects? If I add a collection of
Department and JobType objects as properties of the Organisation object
for example, things slow right down when I try to fill a big collection
of Organisations. Similarly, I would ideally like the User object to
have Organisation, Department and JobType properties but filling a
collection of users again becomes very laborious.
I have come up with a few solutions which I would be happy to discuss in
future posts but none seem very elegant or efficient. Does anyone else
have any thoughts?
Thanks
Graham
I'll try to spell out my problem as succinctly as possible...
My database has a User table, an Organisation table, a Department table
and a JobType table (amongst others)
The Organisation table has a one to many relationship with the other
three. The User table contains foreign keys to the Department and
JobType tables (and the Organisation table).
I want to build User, Organisation, Department and JobType objects
reflecting the data that I can fill from a SqlDataReader. How should I
best include the relationships in the objects? If I add a collection of
Department and JobType objects as properties of the Organisation object
for example, things slow right down when I try to fill a big collection
of Organisations. Similarly, I would ideally like the User object to
have Organisation, Department and JobType properties but filling a
collection of users again becomes very laborious.
I have come up with a few solutions which I would be happy to discuss in
future posts but none seem very elegant or efficient. Does anyone else
have any thoughts?
Thanks
Graham