the new MERGE statement in SQL Server 2008

the new MERGE statement in SQL Server 2008

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


dg78 posted on Monday, November 23, 2009

Hi,

 

Now, with SQL Server 2008, it is possible de pass easily a table to a store procedure and then, with the new MERGE statement, it is possible to insert, update and delete rows in the table in the database with a few code.

 

Is anybody use it with CSLA ?

 

I think that it could be useful for small BLB.

And you, what are your thoughts about that ?

 

Rocky, do you plan to use it in the future ?  is it useful ?

 

Dominique

dlambert replied on Monday, November 23, 2009

I think this would be a lot more appropriate for apps that use DataSets to carry state. In CSLA, chances are your're going to have business objects that are managing the state and data access for each of those rows individually, right?

You'd almost have to build an extra layer (adding on or modifying the DataPortal) to intercept a bunch of updates and aggregate them into a table which would then be sent to a stored proc to be merged, wouldn't you?

If you've got an object that's already managing tabular data directly, though, I don't see that there's anything that would stop you from doing this.

RockfordLhotka replied on Monday, November 23, 2009

I don't see what CSLA would do to help this. You can already do this by overriding DataPortal_Update() in your BLB, or by using an object factory.

As always, the hard part is reconciling the results you get back from SQL Server - all the new primary keys, timestamps, etc - these must be merged back into your object graph after a successful SQL Server call.

Copyright (c) Marimer LLC