DataSource Class
Assembly: CodeEffects.Rule.Editor.dll
Namespace: CodeEffects.Rule.Editor.Client
Summary
Describes a Dynamic Menu Data Source of an Adaptive Source. Fields, parameters, and returns refer to a data source by its Name in their DataSourceName setting.
Syntax
public class DataSource
Properties
Name
Type: System.String
The unique name of the data source, as fields, parameters, and returns name it in their DataSourceName setting.
Items
Type: ICollection<DataSourceItem>
The menu items of the data source, for the Rule Editor used outside the Code Effects Rule Repository: the source provider's GetDataSource method returns them when the editor asks. The Rule Repository never reads or stores them; it calls the method named by Method instead. The default value is an empty collection.
Type
Type: System.Type
The type that declares the data source method, as the Type property of DataAttribute. The Rule Repository requires either this property or TypeOrAliasName, because it calls the method whenever it needs the items. Source.GetDataSources fills it from the DataAttribute of a type.
TypeOrAliasName
Type: System.String
The full name or alias of the type that declares the data source method, as the TypeOrAliasName property of DataAttribute, resolved through the host's type resolver. Used when Type is not set.
Method
Type: System.String
The name of the data source method, as the Method property of DataAttribute. The method must be public, take no parameters, return ICollection<DataSourceItem>, and be either static or declared on a type with a public parameterless constructor. The Rule Repository requires it.
Example
using System.Collections.Generic;
using CodeEffects.Rule.Editor.Client;
var source = new DataSource
{
Name = "Education",
Items = new List<DataSourceItem>
{
new DataSourceItem("school", "High School"),
new DataSourceItem("college", "College")
}
};