Skip to content

Commit 449a50b

Browse files
committed
remove QueryMapperVisitor
1 parent 79fd635 commit 449a50b

File tree

7 files changed

+9
-287
lines changed

7 files changed

+9
-287
lines changed

src/AutoMapper/ApiCompatBaseline.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'AutoMappe
1313
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'AutoMapper.Configuration.Annotations.UseExistingValueAttribute' changed from '[AttributeUsageAttribute(384)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Property)]' in the implementation.
1414
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'AutoMapper.Configuration.Annotations.ValueConverterAttribute' changed from '[AttributeUsageAttribute(384)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Property)]' in the implementation.
1515
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'AutoMapper.Configuration.Annotations.ValueResolverAttribute' changed from '[AttributeUsageAttribute(384)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Property)]' in the implementation.
16-
Total Issues: 14
16+
MembersMustExist : Member 'public System.Linq.IQueryable<TDestination> AutoMapper.QueryableExtensions.Extensions.Map<TSource, TDestination>(System.Linq.IQueryable<TSource>, System.Linq.IQueryable<TDestination>, AutoMapper.IConfigurationProvider)' does not exist in the implementation but it does exist in the contract.
17+
TypesMustExist : Type 'AutoMapper.QueryableExtensions.Impl.MemberAccessQueryMapperVisitor' does not exist in the implementation but it does exist in the contract.
18+
Total Issues: 16

src/AutoMapper/Configuration/MapperConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ TypeMap GetIncludedTypeMap(TypePair pair)
444444
// we want the exact map the user included, but we could instantiate an open generic
445445
if (typeMap?.Types != pair)
446446
{
447-
throw QueryMapperHelper.MissingMapException(pair);
447+
throw TypeMap.MissingMapException(pair);
448448
}
449449
return typeMap;
450450
}

src/AutoMapper/QueryableExtensions/Extensions.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,6 @@ namespace AutoMapper.QueryableExtensions
1616
public static class Extensions
1717
{
1818
/// <summary>
19-
/// Maps a queryable expression of a source type to a queryable expression of a destination type
20-
/// </summary>
21-
/// <typeparam name="TSource">Source type</typeparam>
22-
/// <typeparam name="TDestination">Destination type</typeparam>
23-
/// <param name="sourceQuery">Source queryable</param>
24-
/// <param name="destQuery">Destination queryable</param>
25-
/// <param name="config"></param>
26-
/// <returns>Mapped destination queryable</returns>
27-
public static IQueryable<TDestination> Map<TSource, TDestination>(this IQueryable<TSource> sourceQuery, IQueryable<TDestination> destQuery, IConfigurationProvider config) =>
28-
QueryMapperVisitor.Map(sourceQuery, destQuery, config.Internal());
29-
/// <summary>
3019
/// Extension method to project from a queryable using the provided mapping engine
3120
/// </summary>
3221
/// <remarks>Projections are only calculated once and cached</remarks>

src/AutoMapper/QueryableExtensions/ProjectionBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public Expression CreateInnerProjection(in ProjectionRequest request, Expression
7474
CreateProjectionCore(request, instanceParameter, letPropertyMaps, out var _);
7575
private Expression CreateProjectionCore(in ProjectionRequest request, Expression instanceParameter, LetPropertyMaps letPropertyMaps, out TypeMap typeMap)
7676
{
77-
typeMap = _configurationProvider.ResolveTypeMap(request.SourceType, request.DestinationType) ?? throw QueryMapperHelper.MissingMapException(request.SourceType, request.DestinationType);
77+
typeMap = _configurationProvider.ResolveTypeMap(request.SourceType, request.DestinationType) ?? throw TypeMap.MissingMapException(request.SourceType, request.DestinationType);
7878
return CreateProjectionCore(request, instanceParameter, typeMap, letPropertyMaps);
7979
}
8080
private Expression CreateProjectionCore(ProjectionRequest request, Expression instanceParameter, TypeMap typeMap, LetPropertyMaps letPropertyMaps)

src/AutoMapper/QueryableExtensions/QueryMapperVisitor.cs

Lines changed: 0 additions & 255 deletions
This file was deleted.

src/AutoMapper/TypeMap.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ public void CheckProjection()
5353
{
5454
if (Projection)
5555
{
56-
throw new AutoMapperConfigurationException("CreateProjection works with ProjectTo, not with Map.", QueryMapperHelper.MissingMapException(Types));
56+
throw new AutoMapperConfigurationException("CreateProjection works with ProjectTo, not with Map.", MissingMapException(Types));
5757
}
5858
}
59+
public static Exception MissingMapException(TypePair types) => MissingMapException(types.SourceType, types.DestinationType);
60+
public static Exception MissingMapException(Type sourceType, Type destinationType)
61+
=> new InvalidOperationException($"Missing map from {sourceType} to {destinationType}. Create using CreateMap<{sourceType.Name}, {destinationType.Name}>.");
5962
public bool Projection { get; set; }
6063
public LambdaExpression MapExpression { get; private set; }
6164
internal bool CanConstructorMap() => Profile.ConstructorMappingEnabled && !DestinationType.IsAbstract &&

src/UnitTests/Internal/QueryMapperHelperTests.cs

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)