Nate Bross Posted June 17, 2008 Posted June 17, 2008 Are your data access methods smart enough to populate your business objects from a dataset or is your business object smart enough to populate itself from a dataset? I'm wondering what you guys do, I tend to make my data access populate my business objects... Thoughts? Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Administrators PlausiblyDamp Posted June 17, 2008 Administrators Posted June 17, 2008 I'm lazy ;) I would tend to use an O/R mapper and let it do the hard work. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
tfowler Posted June 18, 2008 Posted June 18, 2008 I've recently started to use LinqToSql. So far, it has been working very well to automatically create business objects from the database tables. Quote
Nate Bross Posted June 18, 2008 Author Posted June 18, 2008 I'm using XML as my primary data source, I have some complex clases to parse this XML and create datasets which I then have my data access basically repopulate into my own custom business objects. The reason for this "double work" is because the XML, which I am not the author, has been known to introduce breaking changes from version to version...so I can't really easily go from XML to BizObject, the DataSet helps me keep keep changes to my code minimal. What would you do in my situation? Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Administrators PlausiblyDamp Posted June 19, 2008 Administrators Posted June 19, 2008 I would tend to make my business object responsible for populating themselves from whatever underlying data source I am using. Personally I don't feel a data layer should have any real intimate knowledge of the higher level classes as this can create unpleasant dependencies. Given your situation I would try and encapsulate the xml parsing and data set creation into it's own layer (with a standard interface if possible) and have my business objects deal with this abstracted layer. The layer may do nothing more than return datasets that my business objects load themselves from though. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.