Adding Username to all persistance operations

Posts   
 
    
Posts: 40
Joined: 01-Sep-2005
# Posted on: 15-Dec-2005 23:07:07   

We are using Adapters. We are wanting to add username (possibly other values) to each table acted on during persistance operations. Ie Every Entity and EntityCollection Save (insert & Update) and the EntityDirect operations. We want to do this in 1 or 2 places if possible...

Is this possible ?

How can I do this ?

I have seen on the Forum people derive a class from the Adapter and override the OnSaveEntity() - but this won't do anything for the Direct Entity updates! Is there someway I can override (add to) the Adapter query generation for all persistance operations to append the Username to the query generated ?

It wont do anything for Stored-Proc's, but we can handle those seperately...

Posts: 40
Joined: 01-Sep-2005
# Posted on: 15-Dec-2005 23:23:20   

Even better - is there a way of passing the required data through to the database (MS SQL Server) - Possibly as part of the ConnectionString then getting a trigger to add this info into the records modified... The Connectionstring can pass the username is SQL authentication is used. We are planning on not using SQL Authentication - we may (in the future) also want to pass other data through to each record!

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
Posts: 40
Joined: 01-Sep-2005
# Posted on: 18-Dec-2005 20:53:44   

Neither cover all persistance mechanisms... How to generically cope with Direct database access... How to generically cope with Cascading of updates... How to generically cope with Stored-Proc updates...

CONTEXT_INFO within SQL server appears to provide a mechanism for this...