F
Freaky Coder
Can anyone tell me if I'm insane or not?
I have a problem where I have a data tier where every class represents a
table, and a class can have properties which are object of another class.
For instance:
Data.Car.Driver ' A Driver class
Data.Car.Passengers ' A Passenger collection class
The problem is, if I then have a business layer that inherits from the data
layer, and I then use the business layer in my UI, the object namespaces can
get out of whack, for instance:
Business.Car.Driver ' Driver comes back as Data.Car.Drvier, because the
implementation code says to return a data driver class.
Now, there's not much I can do about that. So I came up with this idea:
The UI uses the Data objects, which inherits from the Business objects (the
opposite of before). So now in my Data code when I want a property that
isn't an object, say Data.Car.VIN the code looks something like this:
Public Property VIN() As String
Get
' Database implementation code
' Gets the data from the database
' Hands it to the Base (Business) which does its magic
Return(MyBase.VIN)
End Get
Set (ByVal Value As String)
MyBase.VIN = Value
' Database implementation code
End Set
End Property
So basically the DAL gets the data first then hands it off to the Business
which does what it needs to do, then that data goes back to the DAL and
either inserts/updates or outputs. Hence why I call it "Bouncing Tiers".
Now does anyone have a problem with this? I'm very interested in hearing
anyone's opinion.
Horribly Frustrated
I have a problem where I have a data tier where every class represents a
table, and a class can have properties which are object of another class.
For instance:
Data.Car.Driver ' A Driver class
Data.Car.Passengers ' A Passenger collection class
The problem is, if I then have a business layer that inherits from the data
layer, and I then use the business layer in my UI, the object namespaces can
get out of whack, for instance:
Business.Car.Driver ' Driver comes back as Data.Car.Drvier, because the
implementation code says to return a data driver class.
Now, there's not much I can do about that. So I came up with this idea:
The UI uses the Data objects, which inherits from the Business objects (the
opposite of before). So now in my Data code when I want a property that
isn't an object, say Data.Car.VIN the code looks something like this:
Public Property VIN() As String
Get
' Database implementation code
' Gets the data from the database
' Hands it to the Base (Business) which does its magic
Return(MyBase.VIN)
End Get
Set (ByVal Value As String)
MyBase.VIN = Value
' Database implementation code
End Set
End Property
So basically the DAL gets the data first then hands it off to the Business
which does what it needs to do, then that data goes back to the DAL and
either inserts/updates or outputs. Hence why I call it "Bouncing Tiers".
Now does anyone have a problem with this? I'm very interested in hearing
anyone's opinion.
Horribly Frustrated