D
DotNetNewbie
Hi,
In the PHP world, and similiarly in .NET, many people simply do the
SQL queries and return some sort of an array/hashtable (dataset or
datatables) as oppose to a strongly typed class in a collection.
Here is my issue. I have a class that maps to my Articles table, so
it has fields like ArticleID, articleTitle, articleBody, userID,
dateCreated etc.
So I can easily pull all the articles and store them in the class
Article inside some kind of a collection, no issues there.
The problem is this, some times I need to to some INNER JOINS on other
tables, and pull in extra columns. I have many combinations of
queries, so there are many different combinations of these additional
columns.
How do I go about doing this properly?
e.g. I could create another class like 'ArticleSet' or something, and
inherit from Article and then just add the additional columns. But
the problem with this approach is, sometimes these columns will be
NULL since it depends on the query I am performing at the given time
(i.e. if I am pulling all columns, or leaving out some etc).
What is the *best practice* in this scenerio?
Performance is an issue also if that effects anything.....
In the PHP world, and similiarly in .NET, many people simply do the
SQL queries and return some sort of an array/hashtable (dataset or
datatables) as oppose to a strongly typed class in a collection.
Here is my issue. I have a class that maps to my Articles table, so
it has fields like ArticleID, articleTitle, articleBody, userID,
dateCreated etc.
So I can easily pull all the articles and store them in the class
Article inside some kind of a collection, no issues there.
The problem is this, some times I need to to some INNER JOINS on other
tables, and pull in extra columns. I have many combinations of
queries, so there are many different combinations of these additional
columns.
How do I go about doing this properly?
e.g. I could create another class like 'ArticleSet' or something, and
inherit from Article and then just add the additional columns. But
the problem with this approach is, sometimes these columns will be
NULL since it depends on the query I am performing at the given time
(i.e. if I am pulling all columns, or leaving out some etc).
What is the *best practice* in this scenerio?
Performance is an issue also if that effects anything.....