473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Passing data - BUS to DAL to Param object?

First off this is a great reference for passing data between the Data Access
and Business Layers:
http://msdn.microsoft.com/library/de...rchPatPrac.asp

I use my own classes in the Business layer. I want to keep the Data Access
layer from requiring these classes so I tried passing a Datarow between the
layers and it seems to work good for me. Constructing the datarow in the
Class for an update statement and simply passing it up from the Data Access
layer for Loads.

Obviously, using this method I need to construct the DataRow in the class
and then parse it out in the Data Access layer to get it into the Parameters
object to run my Update stored procedure. I am using a XmlSchema file so I
know what the DataRow should look like in the Business layer.

I feel like I am mixing and matching technologies and missing an optimal
solution. My goal is to make the translation from a DataRow into the
Parameters object more dynamic. I don't want to have to change the DAL if I
do something like add a field.

Can anyone point me in the right direction to achieve this? I have very
limited XML experience but if that is the answer then I will happily adopt
it. If you need clarification on anything please email directly or simly
reply to the group.

TIA (Sorry for the length of the post, if you are still reading)

- Marc Castrechini
mc@merchantwarehouseREMOVETHIS.com
Nov 20 '05 #1
3 2666
Hi Marc,

Thanks for posting in the community.

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you have some confusion on how to
separate the business layer from data access layer.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

From me knowledge your design seems ok. Now you will share the xml file
which will descibe the datarow between the DAL and BL. When you add one
field into the the datarow, you will change the xmlfile, so that the DAL
and the BL will know the change. Also when you add one filed into the
datarow, will you also make some change to the DataBase, e.g. add a column
to one the table? If so I'd suggest you do not make two layer, since if you
change the database, your DAL usually need to be changed too.

I also suggest you do not use the concret field name to access the
according field in the dataset in the DAL, so that when you pass the
datarow from BL to DAL, you do not need to make change, you can use the
statement such as "For Each...... Next" or Column(i).

If you still have more detailed question on this issue, please feel free to
post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #2
Marc,
If you are passing a DataRow to you Business Object, it sounds like the
Business Object is coupled to closely to the Data!

The framework that I like to use is based on Martin Fowler's book "Patterns
of Enterprise Application Architecture"
http://www.martinfowler.com/books.html#eaa Especially when Domain Objects
(aka Business Objects) are required, as Martin has a couple useful patterns
when DataSets themselves are more appropriate.

The framework I use with Domain Objects include the following patterns:
Domain Model: http://www.martinfowler.com/eaaCatalog/domainModel.html
Data Mapper: http://www.martinfowler.com/eaaCatalog/dataMapper.html
Unit of Work: http://www.martinfowler.com/eaaCatalog/unitOfWork.html
Separated Interface:
http://www.martinfowler.com/eaaCatal...Interface.html
I understand that the CSLA.NET framework from Rockford Lhotka is also a good
framework. http://www.lhotka.net/

Hope this helps
Jay

"Marc Castrechini" <mc@merchantwarehouseREMOVETHIS.com> wrote in message
news:eQ**************@TK2MSFTNGP10.phx.gbl...
First off this is a great reference for passing data between the Data Access and Business Layers:
http://msdn.microsoft.com/library/de...rchPatPrac.asp
I use my own classes in the Business layer. I want to keep the Data Access layer from requiring these classes so I tried passing a Datarow between the layers and it seems to work good for me. Constructing the datarow in the
Class for an update statement and simply passing it up from the Data Access layer for Loads.

Obviously, using this method I need to construct the DataRow in the class
and then parse it out in the Data Access layer to get it into the Parameters object to run my Update stored procedure. I am using a XmlSchema file so I know what the DataRow should look like in the Business layer.

I feel like I am mixing and matching technologies and missing an optimal
solution. My goal is to make the translation from a DataRow into the
Parameters object more dynamic. I don't want to have to change the DAL if I do something like add a field.

Can anyone point me in the right direction to achieve this? I have very
limited XML experience but if that is the answer then I will happily adopt
it. If you need clarification on anything please email directly or simly
reply to the group.

TIA (Sorry for the length of the post, if you are still reading)

- Marc Castrechini
mc@merchantwarehouseREMOVETHIS.com

Nov 20 '05 #3
That works well for setting up and parsing the datarow. Thank you.

I was hoping to create the parameters collection dynamically from the
dataset but I ran into the problem of not being able to know which kind of
SQLDbType each field is and the size of the field for SQLDbType.varchar from
the XMLSchema. The schema appears to store the field types as a
System.Type.

I'll stick with the DataRow iteration and manually adding parameters.

Thanks,
- Marc

"Peter Huang" <v-******@online.microsoft.com> wrote in message
news:aC*************@cpmsftngxa06.phx.gbl...
Hi Marc,

Thanks for posting in the community.

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you have some confusion on how to
separate the business layer from data access layer.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

From me knowledge your design seems ok. Now you will share the xml file
which will descibe the datarow between the DAL and BL. When you add one
field into the the datarow, you will change the xmlfile, so that the DAL
and the BL will know the change. Also when you add one filed into the
datarow, will you also make some change to the DataBase, e.g. add a column
to one the table? If so I'd suggest you do not make two layer, since if you change the database, your DAL usually need to be changed too.

I also suggest you do not use the concret field name to access the
according field in the dataset in the DAL, so that when you pass the
datarow from BL to DAL, you do not need to make change, you can use the
statement such as "For Each...... Next" or Column(i).

If you still have more detailed question on this issue, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Uma Vivek | last post by:
Hi, I have a problem with Flash remoting via .NET . I seem to have all the code right, but flash does not seem to display the data at all. Here's is what Ive done so far... (1) Ive...
27
by: Oscar | last post by:
I am looking for a way to pass an ADO recordset that has been retrieved in an ASP page to another HTML-page. Is there someone who can provide me with a small sample or a link to see how this is...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
2
by: Barry Moon | last post by:
Hi Can anyone give me any help with passing an object across processes, via drag and drop? I've written a custom ListView control, which supports dragging and dropping of its items. The...
0
by: Neelima Godugu | last post by:
Hi All, I have developed a windows forms user control, which I am going to host in Internet Explorer.. I am familiar with the security settings requirement inorder to do the above. I have...
7
by: TS | last post by:
I was under the assumption that if you pass an object as a param to a method and inside that method this object is changed, the object will stay changed when returned from the method because the...
5
by: Ludwig | last post by:
I have a user control news.ascx that lists news items, and it has add/edit/delete linkbuttons. This user control is on the default.aspx page together with other user controls. When the edit...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.