Saving 500 or so child objects from a Excel Sheet - DataSet

Saving 500 or so child objects from a Excel Sheet - DataSet

Old forum URL: forums.lhotka.net/forums/t/3249.aspx


RSB posted on Monday, July 23, 2007

Hi,

I am using CSLA for my current project and successfully implementing it for our design. It is really exciting and fitting our requirements.

I have a requirement for which I want to implement an effective solution.

I have a excel sheet uploaded to my web app (asp.net 2.0, C#), which will contain 100 - 1000 child object.

My parent object will have the following attributes

name,
id,
childlist1,
childlist2.

Childlist1 and child list 2 will be necessarily from an excel sheet (100 - 1000 rows) How do I save the parent object?

The straightforward way, I think of this is, within the datatable (excel rows and cols converted to datatable in aspx),

for each row in the datatable

{

    initialize the child objects

}

call the parent object's save method and save all the child objects at one stretch.. I handle the db stored proc to retrieve the parent object in xml and save the child object list at one step..

Any other suggestions for performance. I am looping in the front end once to initialize all the objects and looping in the backend to store all the rows(child object table)

Thanks,
RSB

RockfordLhotka replied on Monday, July 23, 2007

One anti-pattern (opposite of design patterns) is Premature Optimization. No sense optimizing unless you know you are going to have a performance issue Smile [:)]

Your approach seems straightforward to me, and is probably what I'd do as a first pass. If it works, great! If not, you can optimize from there.

RSB replied on Tuesday, July 24, 2007

Thank you.

RSB

Copyright (c) Marimer LLC