I am using Dapper Extensions for building my repositories in an MVC app that is configured to use Structuremap. For one of the Models, I need to create a custom mapping to ignore a field.
public class ServiceMapper : ClassMapper<Service>
{
public ServiceMapper()
{
//Ignore this property entirely
Map(x => x.IsRunningNormally).Ignore();
//optional, map all other columns
AutoMap();
}
}
Now to invoke this mapper, I need to set it up, I am calling this line of code in the constructor of my repository.
DapperExtensions.DapperExtensions.DefaultMapper = typeof(ServiceMapper);
As soon as I hit this line, Structuremap tries to resolve the type and throws me exception:
ServiceMonitor.Infrastructure.ServiceMapper is not a GenericTypeDefinition. MakeGenericType may only be called on a type for which Type.IsGenericTypeDefinition is true.
I am not sure what this error means and how to resolve it? Can anyone please guide me as to what is going on here?