Click here to Skip to main content
11,410,750 members (63,151 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET N-Tier
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 28-Dec-12 23:13pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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 Products.
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.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 239
1 Sascha Lefévre 85
2 Dave Kreskowiak 80
3 Maciej Los 68
4 RyanDev 50
0 Sergey Alexandrovich Kryukov 8,885
1 OriginalGriff 6,915
2 Maciej Los 3,390
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web04 | 2.8.150414.5 | Last Updated 29 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100