I've just started playing with DapperExtensions and it looks very promising. However, I'm confused on how to handle registering the ClassMapper subclasses.
I have both a custom PluralizedAutoClassMapper and a regular ClassMapper and I'm trying to use both.
Here's my pluralized mapper...
public class CustomPluralizedMapper<T> : PluralizedAutoClassMapper<T>
where T : class
{
private readonly Type[] SinglularTablePocoTypes = new []{
typeof(LibraryInfo)
};
public override void Table(string tableName)
{
base.Table(tableName);
if(SinglularTablePocoTypes.Any(type => string.Equals(type.Name, tableName, StringComparison.CurrentCultureIgnoreCase)))
TableName = tableName;
}
}
...and here's the mapper specifically for the LibraryInfo class
public class LibraryInfoMapper : ClassMapper<LibraryInfo>
{
public LibraryInfoMapper()
{
Map(libraryInfo => libraryInfo.Name).Column("LibraryName");
Map(libraryInfo => libraryInfo.Description).Column("LibraryDescription");
AutoMap();
}
}
The PluralizedAutoClassMapper I get to work by calling the following...
DapperExtensions.DapperExtensions.DefaultMapper = typeof(CustomPluralizedMapper<>);
But I'm not sure how to use the other one at the same time. What am I missing?