Project

General

Profile

Actions

Feature #6131

closed

Why Transaction is not movable?

Added by Oleg Artenii over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
-
Target version:
-
Start date:
11/13/2017
Due date:
% Done:

0%

Estimated time:

Description

https://github.com/emweb/wt/blob/3175635b60f3389bb1f9d01e4107436f29054229/src/Wt/Dbo/Transaction.h#L92-L94

In my project I have Entities. Each entity has a Model. Each Model is linked to a database (at the moment only one), encapsulates a Wt::Dbo::Session and the logic to do the queries. To the outside world the Model offers functions like Load/Store(Entity).

To be able to make custom/grouped queries and need a common transaction for them. Instead of doing Wt::Dbo::Session& Model::GetSession() (thus everybody will have direct access to session) I want to make:

Wt::Dbo::Transaction Model::CreateTransaction() {
    return Wt::Dbo::Transaction{*mEncapsulatedSession.get()};
}

Then I will be able to do:

{
    Wt::Dbo::Transaction transaction = model.CreateTransaction();
    model.Store(entity1, transaction); // an overloaded Store() that accepts Wt::Dbo::Transaction& as second parameter and doesn't create a new transaction
    model.Store(entity2, transaction);
}

Can you make Transaction movable? I don't see a reason why it's not movable.

#4

Updated by Roel Standaert over 7 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF