The object holding all the metadata for the data context - this only is in place automatically if you called the LoadMetadata method
The ID of the data context in the system
The items in the data context
This method will create a new DataContextItem object and add it to the data context. This method will return the newly created DataContextItem object.
Return a simple object that will have a property for each item in our Items array. We will name each item sequentially as data_item_1, data_item_2, etc, using the itemPrefix parameter
defaults to 'data_item_' and can be set to anything desired
if true, we will include items that have not been loaded due to loading errors in the output object, if false, we will only include items that have been loaded successfully
Return a string that contains a type definition for a simple object for this data context. The object will have a property for each item in our Items array. We will name each item sequentially as data_item_1, data_item_2, etc, using the itemPrefix parameter
defaults to 'data_item_' and can be set to anything desired
if true, we will include items that have not been loaded due to loading errors in the output object, if false, we will only include items that have been loaded successfully
This method will load both the metadata and the data for the data context items associated with the data context. This method will return a promise that will resolve to true if the data was loaded successfully, and false if it was not.
the ID of the data context to load
the data source to use to execute the SQL statement - specified as an any type to allow for any type of data source to be used, but the actual implementation will be specific to the server side only
(defaults to false) for the LoadData() portion of this routine --- if this param is set to true, the data will be reloaded from the data source even if it is already loaded, if false, the data will only be loaded if it hasn't already been loaded
(defaults to false) for the LoadData() portion of this routine --- if this param is set to true, related entity data will be loaded for single record items, if false, related entity data will not be loaded for single record items
(defaults to 0) for the LoadData() portion of this routine --- if this param is set to a value greater than 0, the maximum number of records to load for each relationship will be limited to this value. Applies to single_record items only.
Optional contextUser: UserInfothe user that is requesting the data context (only required on server side operations, or if you want a different user's permissions to be used for the data context load)
This method will load the data for the data context items associated with the data context. This method must be called ONLY after LoadMetadata(). This method will return a promise that will resolve to true if the data was loaded successfully, and false if it was not.
the data source to use to execute the SQL statement - specified as an any type to allow for any type of data source to be used, but the actual implementation will be specific to the server side only
(defaults to false) if true, the data will be reloaded from the data source even if it is already loaded, if false, the data will only be loaded if it hasn't already been loaded
(defaults to false) if true, related entity data will be loaded for single record items, if false, related entity data will not be loaded for single record items
(defaults to 0) for the LoadData() portion of this routine --- if this param is set to a value greater than 0, the maximum number of records to load for each relationship will be limited to this value. Applies to single_record items only.
Optional contextUser: UserInfothe user that is requesting the data context (only required on server side operations, or if you want a different user's permissions to be used for the data context load)
If you already have the data loaded for an entire Data Context you can pass it in as a two dimensional array. The first dimension is the Dataset Item and the second dimension is the array of rows for that given Dataset Item. YOU are responsible for ensuring the ORDER of the first dimension, for the sequence of the Dataset Items, matches the items in the metadata, this method doesn't attempt to do any validation.
This method will load ONLY the metadata for the data context and data context items associated with the data context. This method will not load any data for the data context items. This method will return a promise that will resolve to true if the metadata was loaded successfully, and false if it was not.
the ID of the data context to load
Optional contextUser: UserInfothe user that is requesting the data context (only required on server side operations, or if you want a different user's permissions to be used for the data context load)
Optional provider: IMetadataProvideroptional, the metadata provider to use to load the metadata. If not provided, the default metadata provider will be used.
Saves the data context items to the database. For each data context item, if it has an existing ID in the database, that database record will be updated. For data context items that don't have an ID (meaning they've not yet been saved), a new record will be created in the database. This method will return a promise that will resolve to true if the data was saved successfully, and false if it was not. IMPORTANT: This method will not save if the ID property of the object is not set to a valid value.
Optional contextUser: UserInfooptional, the user that is requesting the data context (only required on server side operations, or if you want a different user's permissions to be used for the data context load)
optional, if true, the data for each item will be saved to the database, if false, the data will not be saved to the database. The default is false.
Simple validation method that determines if all of the items in the data context have data set. This doesn't mean the items have data in them as zero-length data is consider valid, it is checking to see if the Data property is set on each item or not
if set to true, we will ignore individual items that have not been loaded due to loading errors and only validate the data exists in the items that have been loaded. If set to false, we will validate all items regardless of their load state
Static CloneThis method will clone the data context and all of its items. This method will return a promise that will resolve to a new DataContext object if the cloning was successful, and will reject if the cloning was not successful.
Static CreateThis method will create a new DataContextItem object. This method is used internally by the AddDataContextItem method, but can also be called directly if you need to create a DataContextItem object for some other purpose. NOTE: this method does NOT add the newly created DataContextItem to the data context, you must do that yourself if you use this method directly.
Static FromUtility method to create a new DataContext object from a raw data object. This method will return a promise that will resolve to a new DataContext object if the raw data was successfully converted, and will reject if the raw data was not successfully converted.
Static MapUtilty method to map an EntityInfo object's fields to the simpler DataContextFieldInfo object. This is used to simplify the data context item fields.
Base class and the default implementation for the DataContext object, other implementations can be registered as well with higher priorities