public void OnExecuting(object sender, ExecutionCancelEventArgs e) { CreateClassCommand createClassCommand = CreateClassCommand.Evaluate(e.Command); if (createClassCommand == null) { return; } IEngine engine = sender as IEngine; IDatabaseService databaseService = engine.GetService <IDatabaseService>(); ISqlService sqlService = engine.GetService <ISqlService>(); //Begins a new transaction or gets the current transaction IDbTransaction transaction = databaseService.EnsureTransaction(); //Create the database table with the primary key column sqlService.CreateTableWithPrimaryKeyColumn(transaction, createClassCommand.TableName, createClassCommand.Name + "Id"); }