How to get LLBLGen's execute sql statement?

Posts   
 
    
xc_lw2000
User
Posts: 48
Joined: 12-Dec-2006
# Posted on: 09-Jan-2009 16:23:03   

I have some entities to implement the business function. and in addition I have log entity to log the modifies on all entites.

for example: I have a UI to allow users to Add/Modify/Delete an Entity named "EmployeeEntity" and and Entity to log operations on "EmployeeEntity" which named "LogEntity",their schemes as bellow: EmployeeEntity--->EmployeeName --->BirthDay

 LogEntity--->OperatorName
                --->OperateType
                --->OperateDate
                --->OperateSQL

when users add an new EmployeeEntity to database,the code should be like that:


      EmployeeEntity newEmployee=new EmployeeEntity();
      newEmployee.EmployeeName="Jhon";
      newEmployee.BirthDay=new DateTime("1982-01-01");

      newEmployee.Save();

      //Log user's operation(s)
      LogEntity log=new LogEntity();
      log.OperatorName="Tom";
      log.OperateType="Insert";
      log.OperateDate=DateTime.Now;
      log.OperateSQL="insert into Employee(EmployeeName,BirthDay) values('Jhon','1982-01-01')";
      log.Save();

  Notice the red code:
    log.OperateSQL="insert into Employee(EmployeeName,BirthDay) values('Jhon','1982-01-01')";

how can I get the sql statement automaticly or by some methods provider by LLBLGen other than write this manually myself?

 So does Modify and Delete operations
xc_lw2000
User
Posts: 48
Joined: 12-Dec-2006
# Posted on: 10-Jan-2009 16:09:52   

Anybody has solution???

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 10-Jan-2009 18:08:39   

The best way to do this is through the built-in auditing system of llblgen pro, which let you produce entities which are saved when the transaction succeeds, and you then don't have to fiddle with sql statements. See the documentation about auditing, how to set it up etc. and the auditing example on the website.

Frans Bouma | Lead developer LLBLGen Pro