471,593 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Passing business objects from business tier to data tier?

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
2 2480
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

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.

Similar topics

3 posts views Thread by Simon Harvey | last post: by
25 posts views Thread by Stuart Hilditch | last post: by
5 posts views Thread by G. Stewart | last post: by
8 posts views Thread by Keith-Earl | last post: by
18 posts views Thread by D Witherspoon | last post: by
12 posts views Thread by BillE | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

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.