Models node

The Models node in the Mobile configuration defines the models that the mobile app will use. This node can have one or more Category nodes and one or more Model nodes as children.

Category

You can use Category nodes to organize your models. Each Category node can have one or more other Category nodes and one or more Model nodes as children. Each Category node can have these attributes:

Attribute Description
AccessItem List of permissions in Access Control that control access to this category. Specify one or more access IDs in a comma-separated list.
Description Description of the category.
Id Identifier for the category.
Profiles List of profiles that have access to the models in this category. Specify one or more profile IDs in a comma-separated list.

Model

Each Model node defines a specific model for the Mobile Services. Each Model node can have these attributes:

Attribute Description
DisplayName Display name for the model.
Id Unique identifier for the model.
Inherits ID of the base model that the current model inherits from. The current model will inherit the properties of the base model.
IsRootModel Indicates whether the model represents a root object.
IsSharedResource Indicates whether the model represents a shared resource. Shared resources are common records that are used throughout the system, such as addresses and contacts. Marking a model as a shared resource affects how its records are downloaded and stored on the mobile device.

See Shared resources.

Moniker Moniker of the business object that the model is bound to. If you specify a moniker, then the model can access the properties defined for that object. This means that you can use these properties in the mobile app without having to define them explicitly in the mobile model.
No Descriptor Indicates whether the Mobile Metadata service will create a descriptor for this model.
ServiceModels Comma-separated list of models in Rest Services that the Mobile model is associated with. If you specify a service model, then the mobile model can access the properties defined for the service model. This means that you can use these properties in the mobile app without having to define them explicitly in the mobile model.
ServiceType Identifies a specific type of service that will use this model.

Each Model node can have five children: EndPoints, MappingGroups, Properties, PropertyGroups, and Sync.

EndPoints

The EndPoints node defines one or more endpoints for the model. An endpoint defines how a model will connect to the data source. Each EndPoint node can have these attributes:

Attribute Description
Discriminator Discriminator for this endpoint. A discriminator can be used to select an endpoint if there are multiple endpoints with the same number of qualifiers.
EndPoint Endpoint to use in service calls for this model. The endpoint is a path that is appended to the base Rest Services URL in calls to Rest Services.

To include qualifiers in the path, enclose them in curly brackets. For example, the AssetManagement_Asset model has this endpoint, where {Type} is the asset type and {Id} is the primary key:

/assetmanagement/assets/{Type}/{Id}

If a model has more than one endpoint, the mobile services will select the one where the largest number of qualifiers are met. For example, the AssetManagement_Asset model also has this endpoint:

/assetmanagement/assets/{Id}

If a service call includes both an asset type and a primary key, then the first endpoint will be selected. If it includes only a primary key, then the second endpoint will be used instead.

MappingGroups

Mapping groups serve to make selected properties of the parent model available for display in mixed work lists.

A MappingGroups node has one or more Mapping Group nodes as children. Each Mapping Group node has one attribute:

Attribute Description
Id Identifier for the mapping group.

Each Mapping Group node has one or more Mappings nodes as children. A Mappings node serves as the parent for a collection of specific mappings. Each mapping node has these attributes:

Attribute Description
Id Identifier for the mapping.
Source Source of the mapping. You can specify one or more properties of the parent model. If you specify more than one property, enclose each one in curly brackets, such as {Id} {Priority.Code}. You can also specify additional characters to format how the mapped property will be displayed, such as # {ApplicationNumber}.

Properties

The Properties node has one or more Property nodes as children. Each Property node defines a specific property for the parent model.

Note that properties can also be defined on the views that use the model. You only need to define properties on the model itself if you always want them to be present, regardless of the view.

Each Property node can have these attributes:

Attribute Description
Bind Specific component that the property is bound to. For example, to map InspectionModel.InspectionType to InspectionComponent.InspectionType.Code, you would specify InspectionType.Code.
Data Type .NET data type of the property.
Foreign Key ID of the property that serves as a foreign key to link this property to another model. This attribute can be used together with the Model attribute to define relationships between models.
Id Unique identifier for the property.
Is Collection Indicates whether the property carries a collection of data.
Is Primary Indicates whether the property is a primary key.
Model ID of the model that this property is associated with. This attribute can be used together with the Foreign Key attribute to define relationships between models.
Moniker Moniker of the business object that supplies the values for this property.
No Descriptor Indicates whether the Mobile Metadata service will create a descriptor for this property.
Treat 1 As Valid Primary Key For internal use.

Each Property node can have one child Sync node, which defines how the property is downloaded and stored on the mobile device. The Sync node is displayed only for properties that have a model ID entered for the Model attribute. These properties, called model properties, represent data sets rather than single values, so you may want to limit the data that is downloaded.

The Sync node has a child Download node, which in turn has one Items node as a child. The Items node has one or more Item nodes as children, each of which can have these attributes:

Attribute Description
Download Indicates whether the parent property will be downloaded to the mobile device.
ProcessChildAssociations Indicates whether the download will include child properties for associated models.
Profiles Profiles that this item applies to. You can enter multiple profile IDs in a comma-separated list.
RecursionLevel Indicates the depth to which the recursion will execute to download data.
Strategy Describes the strategy by which the data will be downloaded. You can specify one of these values:
  • Association: The item is an associated record. Association is the default.
  • Attachment: The item is an attachment.
  • Cost: The item is a cost record.
  • Detail: The item is a detail.

Each Item node can have a child EndPoints node, which has one or more EndPoint nodes as children. And EndPoint node can have these attributes:

Attribute Description
Discriminator Discriminator for this endpoint. A discriminator can be used to select an endpoint if there are multiple endpoints with the same number of qualifiers.
EndPoint Endpoint to use in service calls for this model. The endpoint is a path that is appended to the base Rest Services URL in calls to Rest Services.

PropertyGroups

The PropertyGroups node has one or more PropertyGroup nodes as children. A property group is a collection of properties that will be used under specified conditions. You use filters to define the conditions for a property group. Each PropertyGroup node has these attributes:

Attribute Description
Moniker Moniker of the business object that the property group is associated with. This will override the moniker of the parent model. For example, in asset property groups, this is used to override the generic Hansen.AssetManagement.Asset with the moniker of a specific asset type.
Name Name of the property group.

Each PropertyGroup node has one Filters node and one Properties node as children. The Filters node has a child Visibility Filter node with one or more Condition nodes as children. Each Condition node defines a condition for the property group. If you define multiple conditions, then all conditions must be met.

Attribute Description
Operation Operator for the comparison. You can specify Equal or NotEqual.
Property Property that the condition will evaluate.
Value Value of the condition.

The Properties node has one or more Property nodes as children. The Property nodes have the same attributes as the Property nodes under the Model node.

Sync

The Sync node can be used to filter data for the parent model when it is downloaded to the local device. For example, you might only want to download assets of a specified type, or addresses with a specified street name.

See Filtering downloaded data.

The Sync node has a child Download node, which in turn has one Items node as a child. The Items node has one or more Item nodes as children, each of which can have these attributes:

Attribute Description
AdditionalQueryParameters Key/value parameters that are used to filter the data that is downloaded for this model. You can enter one or more parameters in a comma-separated list.
DataFilter Filter that is used to limit the data that is downloaded for this model.
Profiles Profiles that this item applies to. You can enter multiple profile IDs in a comma-separated list.