Link Search Menu Expand Document

Db2TypeOutput


This attribute sets the DB2Parameter.DB2TypeOutput property value via a class property. When true, an output-only parameter’s value is returned as a native Db2 data type (a class or struct in the IBM.Data.Db2Types namespace) instead of a plain .NET type.

Attribute

Example usage:

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

    [Db2TypeOutput(true)]
    public DateTime CreatedDateUtc { get; set; }
}

Fluent Mapping

To configure via FluentMapper:

FluentMapper
    .Entity<Person>()
    .PropertyValueAttributes(e => e.CreatedDateUtc, new Db2TypeOutputAttribute(true));

Retrieval

Retrieve the attribute via PropertyValueAttributeCache:

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

We strongly recommend using PropertyValueAttributeCache for maximum performance. See also Db2Type.