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

Passing business objects from business tier to data tier?

P: n/a
Greetings,

I am developing this N-tier business app. The problem I'm facing is
when I try to pass business objects (employees, dept..etc) from
business tier to data tier,i.e., the add method in the data tier
expects business object from the business tier, I get an error saying:
Can not covert businesslayer.emp to businesslayer.emp

Code:

'Business Tier/Employee Class
Public Class emp

Dim name_ As String
Dim clsEmpDataNew As New DataTier.clsEmpData

Property Name() As String
Get
Return name_
End Get
Set(ByVal Value As String)
name_ = Value
End Set
End Property
Function AddNewEmployee(ByVal emp As emp) As Integer
clsEmpDataNew.AddEmployee(emp) 'here where the error occurs
saying can't covert types
End Function

''''Data tier Code
Public Class clsEmpData
Function AddEmployee(ByVal empNew As BusinessTier.emp) As Boolean
'code to call stored procedure
End Function
End Class

Any idea how to solve this? I know I can represent my business
objects as datasets instead of classes, but I found it to be
restrictive more than classes.

MTIA,
Grawsha

May 11 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
gr*********@yahoo.com wrote in news:1178917988.623370.82100
@e65g2000hsc.googlegroups.com:
I am developing this N-tier business app. The problem I'm facing is
when I try to pass business objects (employees, dept..etc) from
business tier to data tier,i.e., the add method in the data tier
expects business object from the business tier, I get an error saying:
Are you using a common interface between the tiers?
May 11 '07 #2

P: n/a

To do this. you need to put those classes in a seperate assembly, NOT the
biz assembly.

http://msdn.microsoft.com/library/de...tml/BOAGag.asp
Deploying Business Entities
Business entities are used at many different tiers in your application.
Depending on how you implement your business entities, you may need to
deploy them to multiple locations if your application spans physical tiers.
The following list describes how to deploy business entities in different
implementation scenarios:

a..
b.. Deploying Business Entities implemented as custom business entity
components. The custom entity class may need to be accessed by the Data
Access Logic Component, depending on how you defined the method signatures
in the Data Access Logic Component.
c.. Follow the same recommendation as for typed DataSets **** by defining
custom entity classes in a common assembly to be deployed on multiple tiers
***.
The data layer should NOT reference the biz layer. The biz layer should
reference the data layer.

When you need objects/datasets among the tiers, they go into a common
("Glue") assembly.


See
5/24/2006
Custom Objects/Collections and Tiered Development
http://sholliday.spaces.live.com/blog/
<gr*********@yahoo.comwrote in message
news:11*********************@e65g2000hsc.googlegro ups.com...
Greetings,

I am developing this N-tier business app. The problem I'm facing is
when I try to pass business objects (employees, dept..etc) from
business tier to data tier,i.e., the add method in the data tier
expects business object from the business tier, I get an error saying:
Can not covert businesslayer.emp to businesslayer.emp

Code:

'Business Tier/Employee Class
Public Class emp

Dim name_ As String
Dim clsEmpDataNew As New DataTier.clsEmpData

Property Name() As String
Get
Return name_
End Get
Set(ByVal Value As String)
name_ = Value
End Set
End Property
Function AddNewEmployee(ByVal emp As emp) As Integer
clsEmpDataNew.AddEmployee(emp) 'here where the error occurs
saying can't covert types
End Function

''''Data tier Code
Public Class clsEmpData
Function AddEmployee(ByVal empNew As BusinessTier.emp) As Boolean
'code to call stored procedure
End Function
End Class

Any idea how to solve this? I know I can represent my business
objects as datasets instead of classes, but I found it to be
restrictive more than classes.

MTIA,
Grawsha

May 11 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.