This repository was archived by the owner on Jun 3, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
actions
blackshadev edited this page Jun 1, 2015
·
3 revisions
Creating actions for HybreDb is currently the only way to get information out of the database besides the already available actions. Luckily this is fairly simplistic to do.
Every action has the following prerequisites:
- It resides within the
HybreDb.Actionsnamespace - It extends the
IHybreActioninterface and implements its members (HybreResult Execute(Database db))- The function
Executereturns an instance ofHybreResult, which will be serialized with JSON.net as a return value
- The function
Within these actions users can do what they like with the given database. Currently the only way to get these actions into the database by compiling them along with the database itself.
using System.Linq;
using HybreDb.Actions.Result;
using HybreDb.Relational;
using HybreDb.Tables;
namespace HybreDb.Actions {
public class HybreActionAll : IHybreAction {
public HybreResult Execute(Database db) {
var res = new HybreUniformResult();
foreach (Table t in db) {
res.Add(t, t.Rows.Select(e => e.Value));
foreach (Relation rel in t.Relations)
res.Add(rel, rel.Table.Rows.Select(e => e.Value));
}
return res;
}
}
}