Link Search Menu Expand Document

Direction


This attribute sets the DbParameter.Direction property value via a class property.

Attribute

Example usage:

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

    public string Name { get; set; }

    [Direction(ParameterDirection.InputOutput)]
    public double Assets { get; set; }
}

Fluent Mapping

To configure via FluentMapper:

FluentMapper
    .Entity<Person>()
    .PropertyValueAttributes(e => e.Assets, new ParameterDirectionAttribute(ParameterDirection.InputOutput));

Properties with an output direction (Output, InputOutput, ReturnValue) are not yet updated with values returned from the database. This capability will be added in a future release.

Retrieval

Retrieve the attribute via PropertyValueAttributeCache:

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

Or via PropertyValueAttributeMapper:

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

We strongly recommend using PropertyValueAttributeCache for maximum performance.