Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Posted
I've recently started to use LinqToSql. So far, it has been working very well to automatically create business objects from the database tables.
Posted

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?

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

  • Administrators
Posted

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...