Link Search Menu Expand Document

Db2Type


This attribute sets the DB2Parameter.DB2Type property value via a class property.

Attribute

Example usage:

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

    [Db2Type(DB2Type.VarChar)]
    public string Name { get; set; }
}

Fluent Mapping

To configure via FluentMapper:

FluentMapper
    .Entity<Person>()
    .PropertyValueAttributes(e => e.Name, new Db2TypeAttribute(DB2Type.VarChar));

Retrieval

Retrieve the attribute via PropertyValueAttributeCache:

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

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