MariaDbType
This attribute sets the MariaDbParameter.MariaDbType 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; }
[MariaDbType(MariaDbType.Text)]
public string Name { get; set; }
}
Fluent Mapping
To configure via FluentMapper:
FluentMapper
.Entity<Person>()
.PropertyValueAttributes(e => e.Name, new MariaDbTypeAttribute(MariaDbType.Text));
Retrieval
Retrieve the attribute via PropertyValueAttributeCache:
var attribute = PropertyValueAttributeCache
.Get<Person>(e => e.Name)?
.FirstOrDefault(e => e.GetType() == typeof(MariaDbTypeAttribute));
Or via PropertyValueAttributeMapper:
var attribute = PropertyValueAttributeMapper
.Get<Person>(e => e.Name)?
.FirstOrDefault(e => e.GetType() == typeof(MariaDbTypeAttribute));
We strongly suggest to always use the PropertyValueAttributeCache to maximize the performance.
The
RepoDb.Connector.MariaDbandRepoDb.Connector.MariaDbConnectorpackages each ship their own, separately-compiledMariaDbTypeAttributetype under the same namespace and simple name. They are not interchangeable — use the one that comes from whichever of RepoDb.MariaDb orRepoDb.MariaDbConnectoryour project references.