oracle11g - How to set dbms_session.set_identifier from Entity Framework -
i trying implement audit trail in web application backed oracle database, have audit trail triggers in place work flawlessly, when user alters data either via sql client toad or when manually use oracle.dataaccess.client via
// rest omitted brevity // var command = new oraclecommand(); command.connection = conn; var useridsql = new stringbuilder(); useridsql.appendline("begin"); useridsql.appendline("dbms_session.set_identifier('username');"); useridsql.appendline("end;"); command.commandtext = useridsql.tostring(); command.executenonquery(); // rest of insert / update / delete code //
what doesn't work when try same overriding savechanges() in dbcontext class.
i assume entity using different above ado.net example on how manages connections , hence reason update happening on wrong database session hence dbms_session not visible trigger.
i did try turning connection pooling off, wasnt of either.
i have tried possible scenarios known me without success.
does here have idea , push me in right direction.
thanks in advance, appreciated.
with kind regards,
max.
i tried did in trace see clientid being reset empty string. here worked me.
my dbcontext
private sisientities db = new sisientities();
i thought in doing following different session works.
oracleconnection conn = db.database.connection oracle.dataaccess.client.oracleconnection; conn.open(); conn.clientid = user.identity.name.tostring().tolower(); db.savechanges();
Comments
Post a Comment