This is a migrated thread and some comments may be shown as answers.

Convert either a DataTable or a XML Doc to ORM Object

1 Answer 88 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kevin
Top achievements
Rank 1
Kevin asked on 12 Aug 2009, 06:09 PM
Hello,

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

1 Answer, 1 is accepted

Sort by
0
PetarP
Telerik team
answered on 14 Aug 2009, 08:07 AM
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,
Petar
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.
Tags
Development (API, general questions)
Asked by
Kevin
Top achievements
Rank 1
Answers by
PetarP
Telerik team
Share this question
or