By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,584 Members | 3,447 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,584 IT Pros & Developers. It's quick & easy.

Data Layer, Business logic layer help

P: n/a
SAL
Hello,
I have a Dataset that I have table adapters in I designed using the designer
(DataLayer). I have a business logic layer that immulates the DataLayer
which may/may not have additional logic in. My business classes are, of
course, decorated with the:

<System.ComponentModel.DataObject() attribute.

So, I drop a GridView on a webform and set its datasource to an
ObjectDatasource which in turn is using one of my business logic classes.

I'm noticing something I find odd in one of my Gridviews. I have it's
datasource set as an object data source which is using a business logic
class. I set the update method to an update method in my business logic
class and the code does indeed step into this update function when after I
have clicked the Edit button, edit data and then click the Update button on
the GridView. So, there the line in this Update function that looks like
this:

Return Adapter.UpdateCntyAssetsAssetManagement(ant, nlca, ar, an,
cntyAssetsId)

What I find odd is if I stop debugging before the above line, the data in
the database still gets changed.
Can anyone tell me why this might occur?
If this is S.O.P. (standard operating proceedure), what could possibly be
the purpose of creating a business logic layer to begin with?

Thoughts?
I have a couple of other issues with this GridView as well but thought I
should get this one ironed out first.
Thanks

SAL
Oct 10 '07 #1
Share this Question
Share on Google+
9 Replies


P: n/a
On Oct 10, 5:36 pm, "SAL" <S...@nospam.nospamwrote:
Hello,
I have a Dataset that I have table adapters in I designed using the designer
(DataLayer). I have a business logic layer that immulates the DataLayer
which may/may not have additional logic in. My business classes are, of
course, decorated with the:

<System.ComponentModel.DataObject() attribute.

So, I drop a GridView on a webform and set its datasource to an
ObjectDatasource which in turn is using one of my business logic classes.

I'm noticing something I find odd in one of my Gridviews. I have it's
datasource set as an object data source which is using a business logic
class. I set the update method to an update method in my business logic
class and the code does indeed step into this update function when after I
have clicked the Edit button, edit data and then click the Update button on
the GridView. So, there the line in this Update function that looks like
this:

Return Adapter.UpdateCntyAssetsAssetManagement(ant, nlca, ar, an,
cntyAssetsId)

What I find odd is if I stop debugging before the above line, the data in
the database still gets changed.
Can anyone tell me why this might occur?
If this is S.O.P. (standard operating proceedure), what could possibly be
the purpose of creating a business logic layer to begin with?

Thoughts?
I have a couple of other issues with this GridView as well but thought I
should get this one ironed out first.
Thanks

SAL
What's in the rest of the Update function in the BLL? Have you tried
commenting that line out and seeing what happens?

Oliver

Oct 11 '07 #2

P: n/a
Hi SA,

I think this is certainly not the expected behavior. I'm wondering whether
there is some component specifcy or project specific things that result to
this problem. Would you try use a very simpler DataAccess class to test
the behavior or your can create a different project for test also.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "SAL" <SA*@nospam.nospam>
Subject: Data Layer, Business logic layer help
Date: Wed, 10 Oct 2007 14:36:18 -0700
>
Hello,
I have a Dataset that I have table adapters in I designed using the
designer
>(DataLayer). I have a business logic layer that immulates the DataLayer
which may/may not have additional logic in. My business classes are, of
course, decorated with the:

<System.ComponentModel.DataObject() attribute.

So, I drop a GridView on a webform and set its datasource to an
ObjectDatasource which in turn is using one of my business logic classes.

I'm noticing something I find odd in one of my Gridviews. I have it's
datasource set as an object data source which is using a business logic
class. I set the update method to an update method in my business logic
class and the code does indeed step into this update function when after I
have clicked the Edit button, edit data and then click the Update button
on
>the GridView. So, there the line in this Update function that looks like
this:

Return Adapter.UpdateCntyAssetsAssetManagement(ant, nlca, ar, an,
cntyAssetsId)

What I find odd is if I stop debugging before the above line, the data in
the database still gets changed.
Can anyone tell me why this might occur?
If this is S.O.P. (standard operating proceedure), what could possibly be
the purpose of creating a business logic layer to begin with?

Thoughts?
I have a couple of other issues with this GridView as well but thought I
should get this one ironed out first.
Thanks

SAL
Oct 11 '07 #3

P: n/a
SAL
I set up one of my other classes to test this out Steven. I created the
update query in the datatable using the designer, added the update method to
the business class, created a new web page, added a GridView and an object
data source set to my business class, put a break point on the line that
should do the actual update, ran it in debug mode, clicked Edit, changed a
value and then clicked update and the code executed as expected and broke on
the line that should do the updating. When the code was stopped at that
line, I clicked the stop debugging button on the tool bar and the database
was indeed updated to the new value I set. While the code was stopped on the
update line, I checked the database and the values had not been changed at
that point. So, this is happening after the stop debugging button has been
clicked in the VS 2005 user interface.
Here's the code for my business class that I used for test. I do not believe
it's anything in the business class that's causing this. I think it's a bug
in VS 2005???

Imports Microsoft.VisualBasic
Imports System.Data.SqlClient
Imports System.Data
Imports CatsDsTableAdapters

<System.ComponentModel.DataObject()_
Public Class PropertyTypesBLL
Private ptTA As CntyPropertyTypesTableAdapter

Protected ReadOnly Property Adapter() As CntyPropertyTypesTableAdapter
Get
If ptTA Is Nothing Then
ptTA = New CntyPropertyTypesTableAdapter
End If
Return ptTA
End Get
End Property

<System.ComponentModel.DataObjectMethodAttribute(S ystem.ComponentModel.DataObjectMethodType.Select,
True)_
Public Function GetPropertyTypes() As CatsDs.CntyPropertyTypesDataTable
Return Adapter.GetPropertyTypes
End Function

<System.ComponentModel.DataObjectMethodAttribute(S ystem.ComponentModel.DataObjectMethodType.Select,
False)_
Public Function GetPropertyTypeByPropertyTypeId(ByVal propertyTypeId As
Integer) As CatsDs.CntyPropertyTypesDataTable
Return Adapter.GetPropertyTypeByPropertyTypeId(propertyTy peId)
End Function

<System.ComponentModel.DataObjectMethodAttribute(S ystem.ComponentModel.DataObjectMethodType.Update,
True)_
Public Function UpdateCntyPropertyType(ByVal propertyType As String,
ByVal propertyTypeId As Integer) As Boolean
Return Adapter.UpdateCntyPropertyType(propertyType, propertyTypeId)
End Function
End Class
Steve
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:mp***************@TK2MSFTNGHUB02.phx.gbl...
Hi SA,

I think this is certainly not the expected behavior. I'm wondering whether
there is some component specifcy or project specific things that result to
this problem. Would you try use a very simpler DataAccess class to test
the behavior or your can create a different project for test also.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
>>From: "SAL" <SA*@nospam.nospam>
Subject: Data Layer, Business logic layer help
Date: Wed, 10 Oct 2007 14:36:18 -0700
>>
Hello,
I have a Dataset that I have table adapters in I designed using the
designer
>>(DataLayer). I have a business logic layer that immulates the DataLayer
which may/may not have additional logic in. My business classes are, of
course, decorated with the:

<System.ComponentModel.DataObject() attribute.

So, I drop a GridView on a webform and set its datasource to an
ObjectDatasource which in turn is using one of my business logic classes.

I'm noticing something I find odd in one of my Gridviews. I have it's
datasource set as an object data source which is using a business logic
class. I set the update method to an update method in my business logic
class and the code does indeed step into this update function when after I
have clicked the Edit button, edit data and then click the Update button
on
>>the GridView. So, there the line in this Update function that looks like
this:

Return Adapter.UpdateCntyAssetsAssetManagement(ant, nlca, ar, an,
cntyAssetsId)

What I find odd is if I stop debugging before the above line, the data in
the database still gets changed.
Can anyone tell me why this might occur?
If this is S.O.P. (standard operating proceedure), what could possibly be
the purpose of creating a business logic layer to begin with?

Thoughts?
I have a couple of other issues with this GridView as well but thought I
should get this one ironed out first.
Thanks

SAL

Oct 11 '07 #4

P: n/a
Thanks for your followup SAL,

I think the cases you provided should be a quite typical one, I'll perform
some test on my side and let you know the result.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "SAL" <SA*@nospam.nospam>
References: <Oc**************@TK2MSFTNGP03.phx.gbl>
<mp*************@TK2MSFTNGHUB02.phx.gbl>
>Subject: Re: Data Layer, Business logic layer help
Date: Thu, 11 Oct 2007 09:13:07 -0700
>
I set up one of my other classes to test this out Steven. I created the
update query in the datatable using the designer, added the update method
to
>the business class, created a new web page, added a GridView and an object
data source set to my business class, put a break point on the line that
should do the actual update, ran it in debug mode, clicked Edit, changed a
value and then clicked update and the code executed as expected and broke
on
>the line that should do the updating. When the code was stopped at that
line, I clicked the stop debugging button on the tool bar and the database
was indeed updated to the new value I set. While the code was stopped on
the
>update line, I checked the database and the values had not been changed at
that point. So, this is happening after the stop debugging button has been
clicked in the VS 2005 user interface.
Here's the code for my business class that I used for test. I do not
believe
>it's anything in the business class that's causing this. I think it's a
bug
>in VS 2005???

Imports Microsoft.VisualBasic
Imports System.Data.SqlClient
Imports System.Data
Imports CatsDsTableAdapters

<System.ComponentModel.DataObject()_
Public Class PropertyTypesBLL
Private ptTA As CntyPropertyTypesTableAdapter

Protected ReadOnly Property Adapter() As CntyPropertyTypesTableAdapter
Get
If ptTA Is Nothing Then
ptTA = New CntyPropertyTypesTableAdapter
End If
Return ptTA
End Get
End Property

<System.ComponentModel.DataObjectMethodAttribute(S ystem.ComponentModel.DataO
bjectMethodType.Select,
>True)_
Public Function GetPropertyTypes() As CatsDs.CntyPropertyTypesDataTable
Return Adapter.GetPropertyTypes
End Function

<System.ComponentModel.DataObjectMethodAttribute(S ystem.ComponentModel.DataO
bjectMethodType.Select,
>False)_
Public Function GetPropertyTypeByPropertyTypeId(ByVal propertyTypeId As
Integer) As CatsDs.CntyPropertyTypesDataTable
Return Adapter.GetPropertyTypeByPropertyTypeId(propertyTy peId)
End Function

<System.ComponentModel.DataObjectMethodAttribute(S ystem.ComponentModel.DataO
bjectMethodType.Update,
>True)_
Public Function UpdateCntyPropertyType(ByVal propertyType As String,
ByVal propertyTypeId As Integer) As Boolean
Return Adapter.UpdateCntyPropertyType(propertyType, propertyTypeId)
End Function
End Class
Steve
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:mp***************@TK2MSFTNGHUB02.phx.gbl.. .
>Hi SA,

I think this is certainly not the expected behavior. I'm wondering
whether
>there is some component specifcy or project specific things that result
to
>this problem. Would you try use a very simpler DataAccess class to test
the behavior or your can create a different project for test also.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
>>>From: "SAL" <SA*@nospam.nospam>
Subject: Data Layer, Business logic layer help
Date: Wed, 10 Oct 2007 14:36:18 -0700
>>>
Hello,
I have a Dataset that I have table adapters in I designed using the
designer
>>>(DataLayer). I have a business logic layer that immulates the DataLayer
which may/may not have additional logic in. My business classes are, of
course, decorated with the:

<System.ComponentModel.DataObject() attribute.

So, I drop a GridView on a webform and set its datasource to an
ObjectDatasource which in turn is using one of my business logic classes.

I'm noticing something I find odd in one of my Gridviews. I have it's
datasource set as an object data source which is using a business logic
class. I set the update method to an update method in my business logic
class and the code does indeed step into this update function when after
I
>>>have clicked the Edit button, edit data and then click the Update button
on
>>>the GridView. So, there the line in this Update function that looks like
this:

Return Adapter.UpdateCntyAssetsAssetManagement(ant, nlca, ar, an,
cntyAssetsId)

What I find odd is if I stop debugging before the above line, the data in
the database still gets changed.
Can anyone tell me why this might occur?
If this is S.O.P. (standard operating proceedure), what could possibly be
the purpose of creating a business logic layer to begin with?

Thoughts?
I have a couple of other issues with this GridView as well but thought I
should get this one ironed out first.
Thanks

SAL


Oct 16 '07 #5

P: n/a
Hi SAL,

After some testing, I've repro this problem and got the same behavior as
you mentioned. Currently I'll do some further research on this and will let
you know if I get any new update.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: st*****@online.microsoft.com (Steven Cheng[MSFT])
Organization: Microsoft
Date: Tue, 16 Oct 2007 02:48:48 GMT
Subject: Re: Data Layer, Business logic layer help
>
Thanks for your followup SAL,

I think the cases you provided should be a quite typical one, I'll perform
some test on my side and let you know the result.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>>From: "SAL" <SA*@nospam.nospam>
References: <Oc**************@TK2MSFTNGP03.phx.gbl>
<mp*************@TK2MSFTNGHUB02.phx.gbl>
>>Subject: Re: Data Layer, Business logic layer help
Date: Thu, 11 Oct 2007 09:13:07 -0700
>>
I set up one of my other classes to test this out Steven. I created the
update query in the datatable using the designer, added the update method
to
>>the business class, created a new web page, added a GridView and an
object
>>data source set to my business class, put a break point on the line that
should do the actual update, ran it in debug mode, clicked Edit, changed
a
>>value and then clicked update and the code executed as expected and broke
on
>>the line that should do the updating. When the code was stopped at that
line, I clicked the stop debugging button on the tool bar and the
database
>>was indeed updated to the new value I set. While the code was stopped on
the
>>update line, I checked the database and the values had not been changed
at
>>that point. So, this is happening after the stop debugging button has
been
>>clicked in the VS 2005 user interface.
Here's the code for my business class that I used for test. I do not
believe
>>it's anything in the business class that's causing this. I think it's a
bug
>>in VS 2005???

Imports Microsoft.VisualBasic
Imports System.Data.SqlClient
Imports System.Data
Imports CatsDsTableAdapters

<System.ComponentModel.DataObject()_
Public Class PropertyTypesBLL
Private ptTA As CntyPropertyTypesTableAdapter

Protected ReadOnly Property Adapter() As CntyPropertyTypesTableAdapter
Get
If ptTA Is Nothing Then
ptTA = New CntyPropertyTypesTableAdapter
End If
Return ptTA
End Get
End Property

<System.ComponentModel.DataObjectMethodAttribute( System.ComponentModel.Data
O
>bjectMethodType.Select,
>>True)_
Public Function GetPropertyTypes() As CatsDs.CntyPropertyTypesDataTable
Return Adapter.GetPropertyTypes
End Function

<System.ComponentModel.DataObjectMethodAttribute( System.ComponentModel.Data
O
>bjectMethodType.Select,
>>False)_
Public Function GetPropertyTypeByPropertyTypeId(ByVal propertyTypeId
As
>>Integer) As CatsDs.CntyPropertyTypesDataTable
Return Adapter.GetPropertyTypeByPropertyTypeId(propertyTy peId)
End Function

<System.ComponentModel.DataObjectMethodAttribute( System.ComponentModel.Data
O
>bjectMethodType.Update,
>>True)_
Public Function UpdateCntyPropertyType(ByVal propertyType As String,
ByVal propertyTypeId As Integer) As Boolean
Return Adapter.UpdateCntyPropertyType(propertyType, propertyTypeId)
End Function
End Class
Steve
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:mp***************@TK2MSFTNGHUB02.phx.gbl. ..
>>Hi SA,

I think this is certainly not the expected behavior. I'm wondering
whether
>>there is some component specifcy or project specific things that result
to
>>this problem. Would you try use a very simpler DataAccess class to test
the behavior or your can create a different project for test also.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "SAL" <SA*@nospam.nospam>
Subject: Data Layer, Business logic layer help
Date: Wed, 10 Oct 2007 14:36:18 -0700
Hello,
I have a Dataset that I have table adapters in I designed using the
designer
(DataLayer). I have a business logic layer that immulates the DataLayer
which may/may not have additional logic in. My business classes are, of
course, decorated with the:

<System.ComponentModel.DataObject() attribute.

So, I drop a GridView on a webform and set its datasource to an
ObjectDatasource which in turn is using one of my business logic
classes.
>>>>
I'm noticing something I find odd in one of my Gridviews. I have it's
datasource set as an object data source which is using a business logic
class. I set the update method to an update method in my business logic
class and the code does indeed step into this update function when
after
>I
>>>>have clicked the Edit button, edit data and then click the Update button
on
the GridView. So, there the line in this Update function that looks like
this:

Return Adapter.UpdateCntyAssetsAssetManagement(ant, nlca, ar, an,
cntyAssetsId)

What I find odd is if I stop debugging before the above line, the data
in
>>>>the database still gets changed.
Can anyone tell me why this might occur?
If this is S.O.P. (standard operating proceedure), what could possibly
be
>>>>the purpose of creating a business logic layer to begin with?

Thoughts?
I have a couple of other issues with this GridView as well but thought I
should get this one ironed out first.
Thanks

SAL




Oct 18 '07 #6

P: n/a
Hi SAL,

After some further research, I did found an existing record indicate this
problem. Actually, this is the behavior of .NET managed debugging. Here is
the detailed description of the issue:

*** Problem Description *******************************************

Behavior
There are cases, when program execution continues after 'Stop debugging'
option
(menu or toolbar) selected in Visual Studio .NET.

Steps to reproduce behavior
1. Create default ASP.NET VB application
2. Add WebForm
3. Add Button to WebForm
4. Add following code to WebForm (you will, probably, have to update
connection
string):
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Handles Button1.Click
Dim cn As New SqlClient.SqlConnection("server=.;uid=sa;pwd=;init ial
catalog=Northwind;")
cn.Open()
Dim cmd As New SqlClient.SqlCommand("update categories set
categoryname=categoryname+'1' where categoryid=1", cn)
cmd.ExecuteNonQuery()
End Sub
5. Set breakpoint on first line of Button1_Click and run the program.
6. Hit 'Stop Debugging' button immediately after debugger reach breakpoint.
7. Inspect your database. In most cases it will be updated!

************************************************

So far you can consider the following resolution:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Cause
Turns out that VS.NET debugger does not suppose to halt managed process
execution
when you 'Stop Debugging'. It is just detaches from process. With unmanaged
code,
this requires killing process.

Resolution
If you will check "Unmanaged code debugging' option in
Project>Properties>Configuration Properties>Debugging, execution will stop
immediately, when 'Stop Debugging' selected.

This article was found at the following link
http://dotnetjunkies.com/WebLog/leon.../10/21590.aspx

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Date: Thu, 18 Oct 2007 08:59:35 GMT
Subject: Re: Data Layer, Business logic layer help
>
Hi SAL,

After some testing, I've repro this problem and got the same behavior as
you mentioned. Currently I'll do some further research on this and will
let
>you know if I get any new update.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.


Oct 22 '07 #7

P: n/a
Hi SAL,

Any progress on this or does the information in my last reply help some?

Please feel free to let me know if there is anything else need help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 24 '07 #8

P: n/a
SAL
Steven,
I haven't looked at this for some time, obviously. The information you
provided concerning the "Unmanaged code debugging" is good to know. What
I've been doing in the mean time is dragging the cursor (yellow in VB) over
the lines of code I didn't want to execute. I think that works but I can't
swear to it yet. I will try your solution as well. I hope there are no side
effects though...

SAL
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:HY**************@TK2MSFTNGHUB02.phx.gbl...
Hi SAL,

Any progress on this or does the information in my last reply help some?

Please feel free to let me know if there is anything else need help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.

Jan 11 '08 #9

P: n/a
Hi SAL,

Glad to hear from you. Sure, welcome to post here if you got any further
results.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "SAL" <SA*@nospam.nospam>
Subject: Re: Data Layer, Business logic layer help
Date: Fri, 11 Jan 2008 11:11:44 -0800
>
Steven,
I haven't looked at this for some time, obviously. The information you
provided concerning the "Unmanaged code debugging" is good to know. What
I've been doing in the mean time is dragging the cursor (yellow in VB)
over
>the lines of code I didn't want to execute. I think that works but I can't
swear to it yet. I will try your solution as well. I hope there are no
side
>effects though...

SAL

Jan 14 '08 #10

This discussion thread is closed

Replies have been disabled for this discussion.