0

I have a table in Access database / SQL server named Employee , Which has the following columns

    EmpId | Name | TempAddress | PerAddress | OffAddress

    123     Harry  India         Odisha       Tamilnadu
    124     Harry  India         Haryana      Banglore
    125     Harry  USA           LA           LA-2nd street

In the above table 3 persons having name Harry those who are staying in 3 different places . What i want is to do some mechanism and make Employee table as class representation , so that the following scenario can be possible . I don't want to write some more code for it from my side , like taking all that things to recordset ,then do the parsing and make a class with the data being present inside recordset .

What i want is mentioned below ::

Employee emp = new Employee[3]

Console.writeline (emp[1].EmpId.Name.OffAddress);\\ output - Tamilnadu
Console.writeline (emp[2].EmpId.Name.OffAddress);\\ output - Banglore
Console.writeline (emp[3].EmpId.Name.OffAddress);\\ output - LA-2nd street

Is the above mechanism possible through .Net (VS 2008/2010 ). Please give me the way to do if some mechanism exist on it .

Thanks in advance ..

Viku
  • 2,845
  • 4
  • 35
  • 63
  • An ORM will do this for you automatically but they usually work poorly with JET/ACE. There's also nothing stopping you from writing code to convert from an OleDbDataReader to entities. – ta.speot.is Sep 06 '13 at 08:46
  • because i am very new to c# and visual studio .Even i searched in Google but dint find any thing feasible And suddenly i got a requirement like this . – Viku Sep 06 '13 at 08:46
  • 1
    http://stackoverflow.com/questions/14138887/what-orm-can-i-use-for-access-2007-2010-im-after-wpf-binding-to-the-tables-e – ta.speot.is Sep 06 '13 at 08:47

1 Answers1

-1

There are plenty of ORMs available in .NET to accomplish your task. Microsoft's EntityFramework, NHibernate are majorly used.

Example for EF: http://msdn.microsoft.com/en-us/data/jj193542.aspx

Sai
  • 159
  • 1
  • 9