diff --git a/lib/datasource.js b/lib/datasource.js index 92475fa5..3671e861 100644 --- a/lib/datasource.js +++ b/lib/datasource.js @@ -55,6 +55,11 @@ function DataSource(name, settings) { return new DataSource(name, settings); } ModelBuilder.call(this, arguments); + + // operation metadata + // Initialize it before calling setup as the adapter might register operations + this._operations = {}; + this.setup(name, settings); // connector @@ -64,9 +69,7 @@ function DataSource(name, settings) { this.DataAccessObject = (connector && connector.DataAccessObject) ? connector.DataAccessObject : this.constructor.DataAccessObject; this.DataAccessObject.call(this, arguments); - // operation metadata - this._operations = {}; - + // define DataAccessObject methods Object.keys(this.DataAccessObject).forEach(function (name) { var fn = this.DataAccessObject[name];