Is your feature request related to a problem? Please describe.
Queryable projection is verbose. In almost all other mappers, these are generated for you by convention.
Describe the solution you'd like
Provide a Mapper configuration (opt-in or opt-out) for generating IQueryable-projections and/or expressions automatically for each defined mapping method without having to define the method definitions. The generated projection should have the same visibility modifier as the mapping definition. The generated names are ProjectTo{TDestination.Name} in order to have a unique intuitive name. (Optionally, the prefix ProjectTo and suffix `` could be configured in the defaults). The generated name can be configured via new attributes MappingProjection(string methodName) and `MappingExpression(string methodName)`.
[Mapper(GenerateQueryable = true, GenerateExpression = true)]
public static partial class PersonDtoMapper
{
[MappingProjection("MyCustomName")]
public static partial PersonDetailDto MapToPersonDetailDto(PersonDbo src);
public static partial PersonViewDto MapToPersonViewDto(PersonDbo src);
// Expect this projection to be generated because of GenerateQueryable = true
// public static IQueryable<PersonDetailDto> MyCustomName(this IQueryable<PersonDbo> src) { ... }
// public static IQueryable<PersonViewDto> ProjectToPersonViewDto(this IQueryable<PersonDbo> src) { ... }
// Expect this expression to be generated because of GenerateExpression = true
// public static Expression<Func<PersonDbo, PersonDetailDto>> ProjectToPersonDetailDto() { ... }
// public static Expression<Func<PersonDbo, PersonViewDto>> ProjectToPersonViewDto() { ... }
}
Describe alternatives you've considered
- Define all projection method definitions by hand.
- Allow all attributes that work on mapping methods to work on projection method definitions to avoid the unused mapping method definition without projection that is used solely for mapping configuration.
Additional context
Is your feature request related to a problem? Please describe.
Queryable projection is verbose. In almost all other mappers, these are generated for you by convention.
Describe the solution you'd like
Provide a Mapper configuration (opt-in or opt-out) for generating
IQueryable-projections and/or expressions automatically for each defined mapping method without having to define the method definitions. The generated projection should have the same visibility modifier as the mapping definition. The generated names areProjectTo{TDestination.Name}in order to have a unique intuitive name. (Optionally, the prefixProjectToand suffix `` could be configured in the defaults). The generated name can be configured via new attributesMappingProjection(string methodName)and `MappingExpression(string methodName)`.Describe alternatives you've considered
Additional context