J
JM
Hello,
I've got a design question, but I'll need to give some background first.
I've inherited a VB.NET WinForm application where the requirement was
"N-Tier". This was implemented based on the tables in the DB and the
name of UI elements. Saving is done via by using reflection and UI
containers. The value UI elements are copied to an object where the
property name matches the name of the DB element, and the property type
is string. Again using reflection, the object is copied over to
another object with the same name and a datatype that matches the DB,
after the form's "save" event has done the two copies, it calls a class
that is specific to the type of the 2nd object (I call it a class
because the class has a single shared method and nothing else), which
then calls one of three methods in a 2nd shared class (again no
instance info for the class). The 3 methods in this last class are
Create, Update and Delete and have the 2nd object as a parameter to be
used when creating sql parameters for Insert, Update and Delete
statements.
Now as to my question: I'm torn between turning the 2 shared classes
into methods on the 2nd object versus trying to create a more generic
data access approach (which isn't coming to me right now). So, what do
the experts here think and if they favor the data access, what would be
a rough description of what you think it should look like?
I've got a design question, but I'll need to give some background first.
I've inherited a VB.NET WinForm application where the requirement was
"N-Tier". This was implemented based on the tables in the DB and the
name of UI elements. Saving is done via by using reflection and UI
containers. The value UI elements are copied to an object where the
property name matches the name of the DB element, and the property type
is string. Again using reflection, the object is copied over to
another object with the same name and a datatype that matches the DB,
after the form's "save" event has done the two copies, it calls a class
that is specific to the type of the 2nd object (I call it a class
because the class has a single shared method and nothing else), which
then calls one of three methods in a 2nd shared class (again no
instance info for the class). The 3 methods in this last class are
Create, Update and Delete and have the 2nd object as a parameter to be
used when creating sql parameters for Insert, Update and Delete
statements.
Now as to my question: I'm torn between turning the 2 shared classes
into methods on the 2nd object versus trying to create a more generic
data access approach (which isn't coming to me right now). So, what do
the experts here think and if they favor the data access, what would be
a rough description of what you think it should look like?