Passing business objects from business tier to data tier?

G

grawsha2000

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
 
G

Guest

(e-mail address removed) wrote in @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?
 
S

sloan

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

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top