Click here to Skip to main content
15,891,908 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I know this is a simple question and I am yet a newbie.

I want to return data by joning 2 tables. "Products" table and "ProductCategory" Table.

In my DAL I have a "Products" class and also a "ProductCategory" class. So do I have to create a new class that has both properties of the Products class and Product Category class? Isn't there any other efficient way to do that?

I searched the net for a whole day now but i couldn't find an answer. I would be glad if you can provide some help?
Posted

1 solution

Why so complicated ?? You can easily be bounded only with 2 tables.
As far as i understood every products has it's own Product category, doesn't it??
In case of YES, accordingly you must inject additional property to your's ProductCategory like List<product> Products</product>.
Otherwise, in case where ProductCategory play role of link table between 2 tables Products and Categories, My answer will be YES , you need to create new DTO class which will be consists of data.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900