How to Create the Business Entities from DataTable RRS feed

  • Question

  • Hi


              I am Sekhar Babu working as Software Engineer.I have problem how to create the Business Entitiy from Datatable.


    I am retrieve a Data from Database and stored in the DataTable. now i want to Create the Business Entities for that DataTable at runtime only.


    i.e for example my DataTable having 50 Records of data of employee information, i want to display that 50 records to the Grid view. But I want to bind the Gridview with Business Entities.So from my DataAccessLayer i want to return the Business Entity. So that I want to Create the Business Entities from DAL at Runtime and Bind the Gridview..


    So Please Help from this Problem as soon as possible.







    Monday, February 11, 2008 10:43 AM

All replies

  • Hi Sekhar,

    Reflection Emit is the way to go if this is really what you want to do.

    I think you should reconsider your choice. What is the reason to want to bind to Business Entities? If they are compelling enough, why wouldn't you generate the Business Entities once from the database and use those? And if they are not, why not use binding against datasets/datatables?

    Hope this helps.

    Monday, February 11, 2008 12:01 PM
  • Hi Rick, Thanks man for u reply..... But Actually my problem is i don't use the dataset/datatables in presentation layer only Business Entities. Exact problem is i am showing the Employee Attendance information. 1. While i am retrieving the Data by Query , it may be retrieve 29 Columns or 30 Columns or 31 Columns 2. I also it may retrieve 1 row or 30 rows. 3. Format is(i.e Data) EmployeeCode 1 2 3 4 5 ...................... 27 28 29 000001 A 8 8 8 8 A A A 000002 A 8 8 8 8 A A A 000003 A 8 8 8 8 A A A 000004 A 8 8 8 8 A A A 000005 A 8 8 8 8 A A A 000006 A 8 8 8 8 A A A in the Above format i am retrieve Data from Database Base on the this Data. 4.I want to create the Business Entities in the DAL Layer and Send to the Presentation Layer. 5.This Business Entity should be created at Runtime only. u got my problem i think so..... can u send the a sample code on reflection Emit and also send the answer for this solution. Regds Sekhar
    Tuesday, February 12, 2008 11:09 AM