Page 1 of 1

Is it possible to use commandtext for function mapping?

Posted: Tue 21 Apr 2009 10:11
by Ido Flatow
I've tried without success to write function mappings for insert/update commands.

When working with sql server we had a function mapping for the update with a commandtext section that contained a sql statement that does the update/insert and afterwards another select statement for the resultbinding, for example:

-- insert row to history table
insert into ... select ...
-- update the row
update table set ...
-- get the results for the updated row
select current_version, updated_date, ... from table where id = :id


(the current_version, updated_date are resultbinding to update some of the entity's properties).

Can someone give me an example of how I can do this when working with oracle?

I need the command text to be a sql command and not a stored procedure call because I have dynamic issues which SPs will be a hard time to implement.

Thanks in advance,
Ido.

Posted: Thu 23 Apr 2009 09:31
by AndreyR
You can write an anonymous PL/SQL block to the CommandText property of some function and then map this function in the
ModificationFunctionMapping section of the MSL part of your .edmx file.
But in case you want to return values from this function, you need to use something like the workaround we have already sent to you.