DataSourceItem Class

Assembly: CodeEffects.Rule.Common.dll
Namespace: CodeEffects.Rule.Common.Models

Summary

Represents a menu item used by the Dynamic Menu Data Sources feature.

Syntax

public class DataSourceItem

Properties

  • ID
    Type: System.Int32

    Gets or sets the numeric ID of the menu item used by the Dynamic Menu Data Sources. See Remarks for details on the use of this property.

  • Key
    Type: System.String

    Gets or sets the string ID (key) of the menu item used by the Dynamic Menu Data Sources. See Remarks for details on the use of this property.

  • Name
    Type: CodeEffects.Rule.Common.Models.GetDataSourceDelegate

    Gets or sets the signature of a method that takes no parameters and returns a collection of DataSourceItem objects used by the Dynamic Menu Data Sources.

  • Filter
    Type: System.String

    Gets or sets the string value used by the Dynamic Menu Data Sources feature to filter out all DataSourceItem menu items whose Name value does not match the specified filter value. This property works together with the Filter values of the FieldAttribute, ParameterAttribute, and MethodAttribute classes.

      using CodeEffects.Rule.Common.Attributes;
      using CodeEffects.Rule.Common.Models;
    
      namespace Test
      {
      	[Data("Education", typeof(Util), "Schools")]
      	public class Patient
      	{
      		[Field(DisplayName = "High School", DataSourceName = "Education", Filter = "school")]
      		public string SchoolID { get; set; }
    
      		[Field(DisplayName = "College", DataSourceName = "Education", Filter = "college")]
      		public string CollegeID { get; set; }
    
      		[Field(DisplayName = "University", DataSourceName = "Education", Filter = "university")]
      		public string UniversityID { get; set; }
      	}
    
      	public class Util
      	{
      		public static List<DataSourceItem> Schools()
      		{
      			var schools = new List<DataSourceItem>();
    
      			schools.Add(new DataSourceItem("One", "School # 1", "school"));
      			schools.Add(new DataSourceItem("Two", "University # 2", "university"));
      			schools.Add(new DataSourceItem("Three", "Third School", "school"));
      			schools.Add(new DataSourceItem("Four", "College # 4", "college"));
      			schools.Add(new DataSourceItem("Five", "College # 5", "college"));
      			schools.Add(new DataSourceItem("Six", "University # 6", "university"));
    
      			return schools;
      		}
      	}
      }
    

    Numeric Calculation

Remarks

The ID and Key properties both represent the identifier of each DataSourceItem in your dynamic menus. The only difference between them is their type: ID is of type System.Int32, while Key is of type System.String. Both properties are used in the same way. The first version of Code Effects included only the numeric ID property, but many customers requested support for a string identifier as well. As a result, the Key property was added while keeping ID for backward compatibility. If both properties are set, the value of Key takes precedence.

p101

l097 --

l102

p101

×