Link Search Menu Expand Document

SapHanaDbType


This attribute sets the HanaParameter.HanaDbType property value via a class property.

This is currently the only parameter attribute for SAP HANA — there is no SourceColumn, SourceColumnNullMapping, or SourceVersion attribute equivalent to the other providers.

Attribute

Example usage:

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

    [SapHanaDbType(HanaDbType.NVarChar)]
    public string Name { get; set; }
}

Fluent Mapping

To configure via FluentMapper:

FluentMapper
    .Entity<Person>()
    .PropertyValueAttributes(e => e.Name, new SapHanaDbTypeAttribute(HanaDbType.NVarChar));

Retrieval

Retrieve the attribute via PropertyValueAttributeCache:

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

We strongly recommend using PropertyValueAttributeCache for maximum performance.