I'd choose the first option applying a pattern called "Lazy Load", using this pattern you just have to keep the value (primary key) received from the class constructor. In this case you don't need to consume another field neither StateCodeRow
class and CountryCodeRow class.
In summary, your AddressRow class knows just the StateCode, so you can get an instance of StateCodeRow passing this value and the StateCodeRow class will not get all the values until it's necessary. The same sample applies to CountryCodeRow
class.
FerVitale
Participant
1114 Points
185 Posts
Re: Question About DAL's
Mar 08, 2007 04:06 PM|LINK
Hi there,
I'd choose the first option applying a pattern called "Lazy Load", using this pattern you just have to keep the value (primary key) received from the class constructor. In this case you don't need to consume another field neither StateCodeRow class and CountryCodeRow class.
In summary, your AddressRow class knows just the StateCode, so you can get an instance of StateCodeRow passing this value and the StateCodeRow class will not get all the values until it's necessary. The same sample applies to CountryCodeRow class.
Please check this link http://www.martinfowler.com/eaaCatalog/lazyLoad.html
If you need some code where it's applying this pattern just let me know.
Regards,
Fernando