DefaultDataContext

DefaultDataContext

Represents the default data context of MOST Data Applications. The default data context uses the adapter which is registered as the default adapter in application configuration.

 adapters: [
 ...
 { "name":"development", "invariantName":"...", "default":false,
    "options": {
      "server":"localhost",
      "user":"user",
      "password":"password",
      "database":"test"
    }
},
 { "name":"development_with_pool", "invariantName":"pool", "default":true,
    "options": {
      "adapter":"development"
    }
}
 ...
 ]
 

Constructor

new DefaultDataContext()

Properties:
Name Type Description
db DataAdapter Gets a data adapter based on the current configuration settings.
Source:

Extends

Members

user

Gets or sets an object that represents the user of the current data context.
Properties:
Type Description
* | Object
Inherited From:
Source:

Methods

finalize(cb)

Finalizes the current data context
Parameters:
Name Type Description
cb function A callback function where the first argument will contain the Error object if an error occured, or null otherwise.
Source:

getConfiguration() → {DataConfiguration}

Gets an instance of DataConfiguration class which is associated with this data context
Source:
Returns:
Type
DataConfiguration

model(name) → {DataModel}

Gets an instance of DataModel class based on the given name.
Parameters:
Name Type Description
name string A string that represents the model name.
Source:
Returns:
- An instance of DataModel class associated with this data context.
Type
DataModel