Saving a large number of entities

Posts   
 
    
absintpm
User
Posts: 22
Joined: 12-Jun-2007
# Posted on: 10-Jul-2007 12:49:13   

Hi again

I am facing the following situation:

I am binding an ASP control to a very large collection and, after that, based on user's selection I need to update a field on the selected entities (objects). I know the Collection.UpdateMulty would be probably the best way of doing that, but I cannot create a update filter unless I use a FieldCompareRangePredicate against an array of entity IDs. If my understanding of how LLBLGen is working is correct, this will generate a very big SQL statement:


update TABLE set Field = [value] where ID in (... very big list of IDs ...)

Is this correct? Which is the best approach for this situation?

I am using LLBLGen 2.0, SelfServicing and SQL Server 2005.

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 10-Jul-2007 16:11:19   

Hi,

I think it is alright to use an "updatemulti" in your case, there is nothing much to do if you genuinely need a complex update.

The other and easier way is to use a Unit of Work. It is what you'll get natively if you rely on a LLBLGenDataSource Control to perform the 2-way binding: instead of using a single complex query, you'll have single update queries run successively.

It should scale up safely, but it will definitely perform slower than a compare range. Now if performance is really an issue maybe you can combine both techniques by splitting the update range into fixed sized arrays and corresponding queries.

Now I don't think the large range should cause problems in the first place, especially if it comes from a user selection, except if the user can select groups of items, in which case it may be that you can introduce join filters to map such groupings.

absintpm
User
Posts: 22
Joined: 12-Jun-2007
# Posted on: 10-Jul-2007 20:07:19   

Thank you Jessynoo. I've split the arrays and corresponding queries. This should solve my data saving problem and now... let's face the data transport from client (browser) to server problem. simple_smile