Ok, I figured it out. The problem was that I am using IoC, and my POCOs are in a different assembly from the mappings.
In short, my model has no idea and does not care about where and how it is stored. It defines only an interface that describes how it needs to interact with this repository. My DAL defines a class that implements this interface, and uses SQLite with storage support. Since mappings only make sense with respect to SQLite, this is where I defined mappings.
The problem is that DapperExtensions is reflected in the assembly, which defines the POCOs that are looking for their ClassMappers, but since mine were in a different assembly, they were not found.
However, you can tell DapperExtensions to search for external assemblies through the following line of code ...
DapperExtensions.DapperExtensions.SetMappingAssemblies(new[]{ assemblyA, assemblyB, ...assemblyN });
So, since my mappings are defined in the same place as my static Mapper class (which has a static “Initialize” call), all I have to do is tell DapperExtensions to look there like that ...
public static class Mappings { public static void Initialize() { DapperExtensions.DapperExtensions.DefaultMapper = typeof(CustomPluralizedMapper<>); DapperExtensions.DapperExtensions.SetMappingAssemblies(new[] { typeof(Mappings).Assembly }); } public class CustomPluralizedMapper<T> : PluralizedAutoClassMapper<T> where T : class { ... } public class LibraryInfoMapper : ClassMapper<LibraryInfo> { ... } }
And now everything works!
Even better, since I can specify the table name in LibraryInfoMapper, there is actually no need for my CustomPluralizedMapper, and so I can just use the standard PluralizedAutoClassMapper, like this ...
public static class Mappings { public static void Initialize() { DapperExtensions.DapperExtensions.DefaultMapper = typeof(PluralizedAutoClassMapper<>); DapperExtensions.DapperExtensions.SetMappingAssemblies(new[] { typeof(Mappings).Assembly }); } public class LibraryInfoMapper : ClassMapper<LibraryInfo> { public LibraryInfoMapper() { Table("LibraryInfo"); AutoMap(); } } }
Done and done! There was ZERO documentation about finding this, so I hope this helps others!