.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> Patten/Practices >> Post New QuestionBookmark and Share Subscribe to Forum

Business Entity

Posted By: Akhil Raj     Posted Date: August 09, 2011    Points:5   Category :Patten/Practices
Hi all,

I am new to architecture and i am am interested in it. Now i have some doubts when i discussed with my friend regarding Business Entity creation.

Take an example, i am creating an application to enter daily expence. I have User, ExpenceType, Expence Entry. Here i can create 3 business enity for User, EnpenceType and ExpenceEntry. Each entity class i have UserID, ExpenceTypeID, EnpenseEntryID etc. Also ExpenseEntry class have UserID and EnpenceTypeID.

My friend told that use single class for all common objects like ID and inherit in other entities. This is best practice and also use singleton pattern. So i am confused and please help to find the answers for the following questions...

1. How i use common class and ID in those base classs using inheritance. Is this better?

2. How i achive singleton pattern using this example?

3. I have UserID and ExpenseTypeId in ExpenceEntry. How i treat this? I mean my way is good like create these IDs in EnpenseEntry entity or any other methos to access from those particluar Entities? Which one is better appraoch?

Author: Mahadesh Mahalingappa             
Posted Date: August 13, 2011     Points: 20   

Hi Akhil,

From what i understand you have three tables ( entities ) User, EnpenceType and ExpenceEntry.

I would suggest you not to use three tables in this case. Atmost I would recommend 2 tables . User and Expenses . The Expenses table has columns of ExpenseType and ExpenseEntry. You would need a primary key on User table as User Id and Primary table on Expenses table as Expense ID. I believe this would do the job for you. Here User & Expenses tables are your Entities.

You could ado.net entity framework to create a data model then.

Please let me know if this helps.


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend