Design question: transferring data between business objects and the data layer

O

olduncleamos

Hi all,

What is, in general, the preferred practice to transfer data between
business objects and the data layer? To be more specific, I have a
couple of business objects with state data that are stored in external
storage. The data layer take care of communicating with the storage and
return data in dataset or file stream or simple arrays. Have the
business objects directly consume a dataset seems inflexible. What
would be the prefered way of handling this most common situation?

To take this discussion further, let say that the current requirments
only requires data to come from a single source. But it is clear that
different data sources will be needed down the road. Would this extra
consideration impact your design? If so, how?

Thanks for all the suggestion and discussion in advance.
 
T

Tom Shelton

olduncleamos said:
Hi all,

What is, in general, the preferred practice to transfer data between
business objects and the data layer? To be more specific, I have a
couple of business objects with state data that are stored in external
storage. The data layer take care of communicating with the storage and
return data in dataset or file stream or simple arrays. Have the
business objects directly consume a dataset seems inflexible. What
would be the prefered way of handling this most common situation?

To take this discussion further, let say that the current requirments
only requires data to come from a single source. But it is clear that
different data sources will be needed down the road. Would this extra
consideration impact your design? If so, how?

Thanks for all the suggestion and discussion in advance.

Lately, I've been playing with NHibernate for this sort of thing.

www.hibernate.org
 
M

Michael Nemtsev

Hello olduncleamos,

o> What is, in general, the preferred practice to transfer data between
o> business objects and the data layer? To be more specific, I have a
o> couple of business objects with state data that are stored in
o> external storage. The data layer take care of communicating with the
o> storage and return data in dataset or file stream or simple arrays.

o> Have the business objects directly consume a dataset seems
o> inflexible. What would be the prefered way of handling this most
o> common situation?

Everything depends on your requirements - if they are always (that usually
ends up they are not in some time later) will be physically nearby there
is no bad to consume DL directly. And it's not the problem to distribute
them later with using WS/COM+/.NET Remoting, the problem is the interface
for the communication - your all data communications should be performed
through well-known (read published) contract (read interfaces)


o> To take this discussion further, let say that the current requirments
o> only requires data to come from a single source. But it is clear that
o> different data sources will be needed down the road. Would this extra
o> consideration impact your design? If so, how?

You can create DL Factory class that will be used by BL and will responsible
for creating specific DL objects to do some kind of job or your can incapsulate
your data sources in interfaces - look at the DataBase providers architecture,
your just have the set of interfaces and your are free to know which DB (oracle,
sql) u are using


---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top