473,657 Members | 2,659 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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@merchantware houseREMOVETHIS .com
Nov 20 '05 #1
3 2679
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@merchantwar ehouseREMOVETHI S.com> wrote in message
news:eQ******** ******@TK2MSFTN GP10.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@merchantware houseREMOVETHIS .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.varch ar 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.m icrosoft.com> wrote in message
news:aC******** *****@cpmsftngx a06.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
2030
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 installed Flash Remoting MX, and copied over the contents of wwwroot\flashremoting\bin into my web application's folder\bin.
27
6188
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 done? regards, Oscar
7
2852
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 parameter to the XSLT stylesheet XsltArgumentList xsltArgList = new XsltArgumentList(); xsltArgList.AddParam("pmID", "", pmID); xmlItems.TransformArgumentList = xsltArgList;
2
4494
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 drag and drop works fine within the same application, but fails
0
2243
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 successfully gotten it working. The only problem I have is with passing parameters to the Windows Forms User control from IE I am using the Object tag to instantiate the IE object I am using param tags inside object tag to pass paramaters but the...
7
3297
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 object is a reference type? my code is not proving that. I have a web project i created from a web service that is my object: public class ExcelService : SoapHttpClientProtocol {
5
1732
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 linkbutton for a news item is clicked, it redirects to another page news.aspx, the news user control is also on this page. Question: when the user clicks the edit linkbutton in the user control
0
8385
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8303
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8502
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8602
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7316
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1941
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.