Link Search Menu Expand Document

SourceVersion


This attribute sets the MariaDbParameter.SourceVersion property value via a class property.

Works with the MySqlConnector-based RepoDb.Connector.MariaDbConnector package, via RepoDb.MariaDbConnector.

Attribute

Example usage:

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

    [SourceVersion(DataRowVersion.Current)]
    public string Name { get; set; }
}

Fluent Mapping

To configure via FluentMapper:

FluentMapper
    .Entity<Person>()
    .PropertyValueAttributes(e => e.Name, new SourceVersionAttribute(DataRowVersion.Current));

Retrieval

Retrieve the attribute via PropertyValueAttributeCache:

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

We strongly recommend using PropertyValueAttributeCache for maximum performance.

The RepoDb.Connector.MariaDb and RepoDb.Connector.MariaDbConnector packages each ship their own, separately-compiled SourceVersionAttribute type under the same namespace and simple name. They are not interchangeable — use the one that comes from whichever of RepoDb.MariaDb or RepoDb.MariaDbConnector your project references.