Skip to content

Entity Framework LookupScriptAttribute [Extensibility]

Victor Tomaili edited this page May 3, 2021 · 1 revision

[namespace: Serenity.ComponentModel] - [assembly: Serenity.Core]

This attribute can be used to apply a script to a row or custom lookup classes. This attribute is used in conjunction with the [LookupEditorAttribute](LookupEditorAttribute [PropertyGrid]).

Attribute definition:

    //
    // Summary:
    //     Placed on rows / or custom lookup classes to denote it has a lookup script.
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
    public sealed class LookupScriptAttribute : Attribute
    {
        //
        // Summary:
        //     Creates a LookupScriptAttribute.
        //
        // Params:
        //   key:
        //     Lookup key, usually in "Module.EntityName" format.
        public LookupScriptAttribute(string key);

        //
        // Summary:
        //     Cache duration in seconds
        public int Expiration { get; set; }
        //
        // Summary:
        //     Lookup key, usually in "Module.EntityName" format.
        public string Key { get; }
        //
        // Summary:
        //     Permission key required to access this lookup script. Use special value "?" for
        //     all logged-in users. Use special value "*" for anyone including not logged-in
        //     users.
        public string Permission { get; set; }
    }

Use:

    [LookupScript("Northwind.Employee")]
    public sealed class EmployeeRow : Row, IIdRow, INameRow
    {
        [...]

See also:

Clone this wiki locally