In my application, I have these projects within a solution:
(1) an ASP.net core api
(2) .NET core class library containing an EF core DbContext and Repository class to be used by the API project and
(3) Another .NET core class library that contains nothing but model classes (so as to define them once)
I'd like to use Automapper, but typical examples involve setting up the mapping in the startup of the containing application eg. ConfigureServices etc. With my approach, I want to contain this within my class library. Where would be a good place to put the mapping in this case? Put it in its own method of the Repository class and call this method from the constructor?
[ update ]
In my case it doesn't seem that a mapping library such as this wont really offer any added benefit, since its rare that any two areas (at most) of the application would return or consume the same mapped objects. My repository is where linq queries are made against the DbContext and projected into domain models. Some of these queries can be non-trivial and doing this within the constraints of yet another mapping layer wouldn't seem to serve the purpose of being a central place where all the mappings take place, since that mapping is only to be done once or twice at most.