I've got a simple solution structure of API project, DAL project (Class Library), shared Models project. Inside the DAL project I've created a custom map for one of my POCO's:
internal class AssumptionsMap : EntityMap<Assumptions>
{
internal AssumptionsMap()
{
Map(a => a.Rate).ToColumn("InitialRate");
Map(a => a.Credit).ToColumn("CredValue");
Map(a => a.CreditType).ToColumn("CredType");
}
}
I've created this in the DAL project (Class Library) as this is where it will need to be used in the repository which calls off to get the Assumptions. However, where do I add this:
FluentMapper.Initialize(cfig =>
{
cfig.AddMap(new AssumptionsMap());
});
My DAL project doesn't have an 'App_Start' as that's in the API project, so how can this map be initialized? I feel like I'm missing something obvious here.
My current attempt is to simply use a static constructor on the QueryStore
class I've created that houses all my dapper queries. However, nothing seems to happen when doing this:
public class QueryStore
{
public const string GetSomething = @"some query";
// more queries
static QueryStore()
{
FluentMapper.Initialize(cfig =>
{
cfig.AddMap(new CommonAssumptionsMap());
});
}
}