Convert either a DataTable or a XML Doc to ORM Object

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    3 posts
    Member since:
    May 2009

    Posted 12 Aug 2009 Link to this post


    I am new to the ORM world, but so far have found it to my liking.  Here is the problem I am trying to solve:

    I have an old ASA Sybase database (8.03 - not supported by Open Access), I am getting data out of there by way of web service methods which return DataTables.  I have generated the same table structure in SQL2005 and built Business objects.  Those object fields are 1:1 with the columns in the DataTable. 

    Is there a way to load the information from the DataTable to the Business object that does not involve explicity doing all of assignments on a column by column basis?

    Its not a big deal for 1 Table and 20 columns, but I am looking at 100+ tables and more than a thousand columns.  I want to believe there is a generic way to set this up and execute it against any DataTable/Business Object whose columns/fields are identical in name and quantity.

    My thanks in advance for any insight, thoughts, or suggestions that may be out there.

    Kevin Westphal
  2. PetarP
    PetarP avatar
    754 posts

    Posted 14 Aug 2009 Link to this post

    Hello Kevin,

    We are not really able to see your goal here. It is possible using reflection to create generic method that will convert each data Table to a list of persistent classes but this wont give you any benefits. The problem here will be that the objects that you will transfer from the Data Tables wont be tracked by the object scope. You wont get any speed or optimizations in place and you wont be able to work with our objectscope at all. From our perspective it will make sense using data tables to move your data into the SQL Server (since you already have the database in place) and operate entirely using OpenAccess as this will bring you much benefits.

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
Back to Top