U
Uchiha Jax
I have a strongly typed dataset, within this dataset I have strongly typed
datarows, say for example a TaskRow which contains all of the information
about a task.
This TaskRow object is an excellent representation of the kind of
programming object I want to use in my program, it perfectly reflects the
database structure and has all of the properties I want, additionally if I
modify the structure I need only update the XML file and regenerate my
dataset.
The question is how do I expand this class? I want to add methods and
properties and would also like a definition that wasn't locked inside of the
DataSet type it is generated in.
Inheriting from the class seems impossible as it has the "hands off"
DataRowBuilder object as one of the constructor parameters and it whinges
whenever I try to specify a new constructor type.
If I don't inherit I end up just passing the DataRow into another object
which takes it as a parameter and just uses properties to forward requests
on the datarow:
e.g
TaskRow tRow;
public int TaskID
{
get{return tRow.TaskID;}
}
This feels clunky and wrong, as the new object is just a layer infront of
the other object and whenever the data gets updated I have to modify the
properties in the class.
Is this honestly the right way to do this or is there a better way?
Additionally I would assume it would be possibly bad to pass the datarow
into the logic section of the program as I understand that the Business
Logic and Data Tier should generally be kept seperate.
How is it that people deal with these problems on an enterprise scale? Does
everyone have methods that just perform conversion in the data layer? eg
public TaskObj GetTaskObject(TaskRow tRow)
{
TaskObj tObj = new TaskObj();
tObj.TaskID = tRow.TaskID;
return tObj;
}
Just seems wierd to write a bunch of methods that just copy properties,
seems inefficient for some reason.
Just want some advice from more learned individuals as i'm looking to take
on a large project pretty soon and still have these questions unanswered in
my mind.
Thanks for responding, if you do.
Kind Regards
Jax
datarows, say for example a TaskRow which contains all of the information
about a task.
This TaskRow object is an excellent representation of the kind of
programming object I want to use in my program, it perfectly reflects the
database structure and has all of the properties I want, additionally if I
modify the structure I need only update the XML file and regenerate my
dataset.
The question is how do I expand this class? I want to add methods and
properties and would also like a definition that wasn't locked inside of the
DataSet type it is generated in.
Inheriting from the class seems impossible as it has the "hands off"
DataRowBuilder object as one of the constructor parameters and it whinges
whenever I try to specify a new constructor type.
If I don't inherit I end up just passing the DataRow into another object
which takes it as a parameter and just uses properties to forward requests
on the datarow:
e.g
TaskRow tRow;
public int TaskID
{
get{return tRow.TaskID;}
}
This feels clunky and wrong, as the new object is just a layer infront of
the other object and whenever the data gets updated I have to modify the
properties in the class.
Is this honestly the right way to do this or is there a better way?
Additionally I would assume it would be possibly bad to pass the datarow
into the logic section of the program as I understand that the Business
Logic and Data Tier should generally be kept seperate.
How is it that people deal with these problems on an enterprise scale? Does
everyone have methods that just perform conversion in the data layer? eg
public TaskObj GetTaskObject(TaskRow tRow)
{
TaskObj tObj = new TaskObj();
tObj.TaskID = tRow.TaskID;
return tObj;
}
Just seems wierd to write a bunch of methods that just copy properties,
seems inefficient for some reason.
Just want some advice from more learned individuals as i'm looking to take
on a large project pretty soon and still have these questions unanswered in
my mind.
Thanks for responding, if you do.

Kind Regards
Jax