Link Search Menu Expand Document

SqliteType


This attribute sets the SqliteParameter.SqliteType property value via a class property.

Only works with the Microsoft.Data.Sqlite package.

Attribute

Example usage:

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

    [SqliteType(SqliteType.Text)]
    public string Name { get; set; }
}

Fluent Mapping

To configure via FluentMapper:

FluentMapper
    .Entity<Person>()
    .PropertyValueAttributes(e => e.Name, new SqliteTypeAttribute(SqliteType.Text));

Retrieval

Retrieve the attribute via PropertyValueAttributeCache:

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

Or via PropertyValueAttributeMapper:

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

We strongly recommend using PropertyValueAttributeCache for maximum performance.