Actions
Feature #6131
closedWhy Transaction is not movable?
Status:
Closed
Priority:
Urgent
Assignee:
-
Target version:
-
Start date:
11/13/2017
Due date:
% Done:
0%
Estimated time:
Description
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.
Actions