Improved plugin initialization. Added delete feature.
This commit is contained in:
@@ -21,6 +21,10 @@ class Service
|
||||
public:
|
||||
Service() { }
|
||||
|
||||
explicit Service(const QString &pluginId) {
|
||||
m_pluginId = pluginId;
|
||||
}
|
||||
|
||||
QList<QSharedPointer<T> > all() {
|
||||
odb::database *db = Context::instance().db();
|
||||
|
||||
@@ -69,6 +73,16 @@ public:
|
||||
return entity;
|
||||
}
|
||||
|
||||
void erase(QSharedPointer<T> entity) {
|
||||
odb::database *db = Context::instance().db();
|
||||
|
||||
Q_ASSERT(db);
|
||||
|
||||
Transaction tx;
|
||||
db->erase(entity);
|
||||
tx.commit();
|
||||
}
|
||||
|
||||
void setPluginId(const QString &pluginId) {
|
||||
m_pluginId = pluginId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user