Link Search Menu Expand Document

ArrayLength


This attribute sets the DB2Parameter.ArrayLength property value via a class property. Specifies the number of elements of the Value property to use for parameter bind-in.

Attribute

Example usage:

public class Person
{
    public int Id { get; set; }

    [ArrayLength(3)]
    public string[] Names { get; set; }
}

Fluent Mapping

To configure via FluentMapper:

FluentMapper
    .Entity<Person>()
    .PropertyValueAttributes(e => e.Names, new ArrayLengthAttribute(3));

Retrieval

Retrieve the attribute via PropertyValueAttributeCache:

var attribute = PropertyValueAttributeCache
    .Get<Person>(e => e.Names)?
    .FirstOrDefault(e => e.GetType() == typeof(ArrayLengthAttribute));

We strongly recommend using PropertyValueAttributeCache for maximum performance.