Applied to business classes' reference and collection properties. Specifies the name of a collection property used as the data source for a List View displayed in a Lookup Property Editor or invoked by the LinkUnlinkController.LinkAction Action in a popup window.
[AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] public class DataSourcePropertyAttribute : ModelExportedValuesAttribute
<AttributeUsage(AttributeTargets.Property, Inherited:=True, AllowMultiple:=False)> Public Class DataSourcePropertyAttribute Inherits ModelExportedValuesAttribute
You can filter the data source for the List View displayed in a Lookup Property Editor or in the LinkUnlinkController.LinkAction Action's popup window. For this purpose, apply the DataSourceProperty attribute to the target property. Specify a collection property using the attribute's DataSourcePropertyAttribute.DataSourceProperty parameter. This collection must contain objects of the target property's type or its descendants. These objects will actually be displayed in the Lookup List View of the target property. The collection property must provide information on the element type. It can be an associated collection, a generic collection or an untyped collection decorated with the CollectionAttribute.
An independent server-mode collection is created as a data source for a lookup ListView when the IModelListView.DataAccessMode option is set to Server, ServerView, InstantFeedback, or InstantFeedbackView for that ListView model. However, when the DataSourcePropertyAttribute is applied for the lookup property, the property pointed in the attribute is used as a lookup data source, and the standalone independent server-mode collection is not created and is not used at all. The reason is that the data source property getter contains logic calculated on the client side and the data source is populated by the client application at the moment when the lookup editor requests to display objects. So, the Server, ServerView, InstantFeedback, or InstantFeedbackView mode option and the DataSourceProperty attribute do not work simultaneously.
You can set the collection that will be displayed by the Lookup List View when the source property is not specified. To do this, pass a DataSourcePropertyIsNullMode enumeration value as the DataSourceProperty attribute's DataSourcePropertyAttribute.DataSourcePropertyIsNullMode parameter. If you pass the DataSourcePropertyIsNullMode.CustomCriteria value, specify criteria for filtering the target property's data source. To do this, pass the criteria using the DataSourcePropertyAttribute.DataSourcePropertyIsNullCriteria parameter. In the criteria, you can use Function Criteria Operators and the Current Object Parameter.
To see examples of this attribute in use, refer to the How to: Implement Cascading Filtering for Lookup List Views topic.
The values that you pass as the DataSourceProperty attribute's parameters are assigned to the corresponding properties of the Application Model's BOModel | <Class> | OwnMembers | <Member> node. Note, you can set or change values of these attributes directly in the Application Model using the Model Editor. The values that are set in the Application Model are used when constructing the application UI.
- By default, the criteria which is set for a property using the DataSourceProperty attribute in a base business class remains applied in the business class descendants.
An object which is added to a lookup via the New Action is always displayed, regardless of whether or not the DataSourceProperty or DataSourceCriteria attributes are applied.