Click here to Skip to main content
12,635,149 members (23,268 online)
Rate this:
 
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<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.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161208.2 | Last Updated 29 Dec 2012
Copyright © CodeProject, 1999-2016
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