J
Jeff
hi
asp.net 2.0
I have a database here containing 2 tables, Order and OrderLines. OrderLines
has a foreign key to Order...
Until know I have created an entity class for Order (public class Order, not
using DataSet), containing only the fields available in the Order table.
But now I often need to know how many OrderLines are linked to a specific
Order.
So I thought about adding a int Count field to the Order entity. So when I
run the stored procedure returning the Order, it has to do a count on
OrderLines connected to this Order. But not sure that is best practice,
because when I create a new Order I must set this value to 0. And also the
Count field is not a real field in the Order table.
Maybe there is an even better approach? Can I create a Order entity having
links to OrderLines entity? Then maybe my Order entity could have a
OrderLine collection property...?
any suggestions? links to articles would be great.
asp.net 2.0
I have a database here containing 2 tables, Order and OrderLines. OrderLines
has a foreign key to Order...
Until know I have created an entity class for Order (public class Order, not
using DataSet), containing only the fields available in the Order table.
But now I often need to know how many OrderLines are linked to a specific
Order.
So I thought about adding a int Count field to the Order entity. So when I
run the stored procedure returning the Order, it has to do a count on
OrderLines connected to this Order. But not sure that is best practice,
because when I create a new Order I must set this value to 0. And also the
Count field is not a real field in the Order table.
Maybe there is an even better approach? Can I create a Order entity having
links to OrderLines entity? Then maybe my Order entity could have a
OrderLine collection property...?
any suggestions? links to articles would be great.