Geeks With Blogs

News Ashraful Alam Joy

Create Your Badge

Ashraful Alam is a Software Architect, who has 8 years of professional experience in Software Development industry. This Bangladeshi national is involved with project management and development of several US based software projects from his country. Already he has managed and developed several software projects, which are being used by several users of different countries, such as USA, Canada, Australia, and Bangladesh. While developing and managing a team, he contains and maintains a set of well defined engineering practices developed by him and other online developer communities.

Due to his willingness to give effort to improve and share better software development practices, Ashraf has been awarded as “Most Valuable Professional” (MVP) in ASP.NET category by Microsoft since year 2007 multiple times, which is a rare honor and prestigious reorganization among the developers around the world.

Check his portfolio to know more about him and his works.

.NETTER Characters... Every part of your life is best, if you can know yourself and thus create your life like an artist!

Let’s consider a simple sample:

Contact db table: Contact ID (primary key), Contact Name, Contact Address

Employee db table: Employee ID (primary key), Employee Joining Date

Customer db table: Customer ID (primary key), Customer Birth Date

Now to utilize the object oriented inheritance concept in relational database model, we can create a one to one relation with Contact table with Employee and Customer table, where besides primary key, Employee ID and Customer ID will be used as the foreign key of Contact table, regarding the concept that all Employees and Customers are considered as a “Contact” object.


Now if we wish to map this idea to real world OOP code, we will create a business entity named “Contact” which inherited sub classes will be “Employee” and “Customer” business entity. The corresponding BLL and/or DAL (Data Access Layer) class of “Employee” or “Customer” can also be inherited from BLL (Business Logic Layer) and/or DAL class of “Contact” to perform required operations in object oriented manner.

Posted on Sunday, April 20, 2008 1:14 PM | Back to top

Comments on this post: Design Factors 4: How do you map OOP concepts to relational database design?

# re: Design Factors 4: How do you map OOP concepts to relational database design?
Requesting Gravatar...
How do we do this?
Let's say I have these tables.
Product : ProductId(pk), ProductTitle,...
Images : ImgId(pk), ImgName, ImgCategory/type,..,
Files : FileId(pk), FileName,...,fkProductId

How should I create Entity classes for them?

Also let's consider one specific example.
I need to list products.
In the listing I need to show product title, top 2 of the images that are related to this product, and links to to 2 of the files related to this product.

Let's say we are working on a method GetProducts(...) for this purpose.
My question is what kind of Entity Class object this should return.
A Product object with Files Collection and Images Collection as properties?

Let's consider one more scenario.
I need to list all the images for a given product.
I also need to list all the files for a given product.
We work on 2 methods like
GetImagesByProduct(...) and GetFilesByProduct(...)
So what should they return?
An Image class object which has Product object as a property?? Or all/specific product attributes are made properties of the Image class?
Left by chirag on Jun 30, 2008 11:00 PM

Your comment:
 (will show your gravatar)

Copyright © Ashraf Alam | Powered by: