Skip to content

Entity Framework LookupIncludeAttribute [Mapping]

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

[namespace: Serenity.Data.Mapping] - [assembly: Serenity.Data]

This attribute can be used to make a field that is not included by default in lookup scripts available at client side for lookup.

public sealed class CustomerRow : Row, IIdRow, INameRow
{
    [...]

    public String CompanyName
    {
       get { return Fields.CompanyName[this]; }
       set { Fields.CompanyName[this] = value; }
    }

    [LookupInclude]
    public String OtherField
    {
       get { return Fields.OtherField[this]; }
       set { Fields.OtherField[this] = value; }
    }

    [...]

    IIdField IIdRow.IdField
    {
        get { return Fields.ID; }
    }

    StringField INameRow.NameField
    {
        get { return Fields.CompanyName; }
    }

The default values insert in Lookup are the fields of [IIdRow](IIdRow Interface) and [INameRow](INameRow Interface) interface (if present). In this case the OtherField field are selected for lookup only if is present the LookupInclude attribute.

See also:

Clone this wiki locally