StrataFrame Forum

Use of the internal data table

http://forum.strataframe.net/Topic192.aspx

By John Frankewicz - 11/30/2005

We are going to have a very large application, with many business objects. Many of the business objects will have a lifetime equivalent to the time the application is running, for efficiency reasons. Also most of the objects will represent  just one record in the database.

Is there a penality to pay, in terms of memory usage, by keeping the Datatable around rather than storing the columns in private variables, wrapped with properties and then getting rid of the datatable?

I guess I am making an assumption about what is going on so correct me if I am wrong Smile

There are so many things in this product and I am impressed, and trying to convince my associates this is the tool to use.

Thanks for all your help

By StrataFrame Team - 11/30/2005

There is a slight memory penalty for using a DataTable with one record, but nothing like using a DataSet. This is the main reason we used a DataTable rather than a DataSet. If you use a DataSet with only one record, you're looking at about 8x the memory usage as a DataTable with only one record.



Realistically, the memory usage penalty is negligable for storing only one record in a DataTable and it's worth it to incur that penalty to be able to store multiple records in the same class that is used to store a single record.



With an O/R mapper, you'd have a slightly smaller memory footprint for each "entity" object, but the entity collections are not as efficient at storing multiple records as a DataTable. The performance and functionality penalties of using the custom collection are far worse than the memory penalty of the DataTable.



Note: This is especially true for .NET 2.0 as the ADO.NET team really improved the indexing performance of a DataTable making it much faster than a custom collection for sorting, filtering, and navigating the records.