Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fail sooner
  • Loading branch information
lbargaoanu committed Apr 29, 2020
commit 0b9ad86dba3d429643d2f6fc98f2603e1905fe88
31 changes: 31 additions & 0 deletions src/AutoMapper/ApiCompatBaseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ InterfacesShouldHaveSameMembers : Interface member 'AutoMapper.IRuntimeMapper.Ma
InterfacesShouldHaveSameMembers : Interface member 'AutoMapper.IRuntimeMapper.Map<TSource, TDestination>(TSource, System.Action<AutoMapper.IMappingOperationOptions<TSource, TDestination>>)' is present in the implementation but not in the contract.
InterfacesShouldHaveSameMembers : Interface member 'AutoMapper.IRuntimeMapper.Map<TSource, TDestination>(TSource, TDestination, System.Action<AutoMapper.IMappingOperationOptions<TSource, TDestination>>)' is present in the implementation but not in the contract.
CannotChangeAttribute : Attribute 'System.Runtime.CompilerServices.IteratorStateMachineAttribute' on 'AutoMapper.MapperConfiguration.GetIncludedTypeMaps(System.Collections.Generic.IEnumerable<AutoMapper.TypePair>)' changed from '[IteratorStateMachineAttribute(typeof(MapperConfiguration.<GetIncludedTypeMaps>d__69))]' in the contract to '[IteratorStateMachineAttribute(typeof(MapperConfiguration.<GetIncludedTypeMaps>d__72))]' in the implementation.
<<<<<<< HEAD
TypesMustExist : Type 'AutoMapper.MemberFinderVisitor' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'AutoMapper.PropertyMap.UseDestinationValue.set(System.Boolean)' does not exist in the implementation but it does exist in the contract.
=======
MembersMustExist : Member 'public System.Collections.Generic.IEnumerable<System.Reflection.MemberInfo> AutoMapper.PropertyMap.SourceMembers.get()' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'public System.Boolean AutoMapper.PropertyMap.UseDestinationValue.get()' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'public void AutoMapper.PropertyMap.UseDestinationValue.set(System.Boolean)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'public void AutoMapper.Configuration.CtorParamConfigurationExpression<TSource>..ctor(System.String)' does not exist in the implementation but it does exist in the contract.
>>>>>>> fail sooner
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'AutoMapper.Configuration.Annotations.IgnoreAttribute' changed from '[AttributeUsageAttribute(384)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Property)]' in the implementation.
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'AutoMapper.Configuration.Annotations.MapAtRuntimeAttribute' changed from '[AttributeUsageAttribute(384)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Property)]' in the implementation.
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'AutoMapper.Configuration.Annotations.MappingOrderAttribute' changed from '[AttributeUsageAttribute(384)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Property)]' in the implementation.
Expand All @@ -34,6 +41,7 @@ CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'AutoMappe
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.
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.
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'AutoMapper.Configuration.Conventions.MapToAttribute' changed from '[AttributeUsageAttribute(384)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Property)]' in the implementation.
<<<<<<< HEAD
MembersMustExist : Member 'AutoMapper.Execution.DelegateFactory.GenerateConstructorExpression(System.Type, AutoMapper.ProfileMap)' does not exist in the implementation but it does exist in the contract.
InterfacesShouldHaveSameMembers : Interface member 'AutoMapper.QueryableExtensions.IExpressionResultConverter.CanGetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.ConstructorParameterMap)' is present in the contract but not in the implementation.
MembersMustExist : Member 'AutoMapper.QueryableExtensions.IExpressionResultConverter.CanGetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.ConstructorParameterMap)' does not exist in the implementation but it does exist in the contract.
Expand All @@ -54,3 +62,26 @@ MembersMustExist : Member 'AutoMapper.QueryableExtensions.Impl.MemberResolverExp
MembersMustExist : Member 'AutoMapper.QueryableExtensions.Impl.MemberResolverExpressionResultConverter.GetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.ConstructorParameterMap)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'AutoMapper.QueryableExtensions.Impl.MemberResolverExpressionResultConverter.GetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.PropertyMap, AutoMapper.QueryableExtensions.LetPropertyMaps)' does not exist in the implementation but it does exist in the contract.
Total Issues: 54
=======
MembersMustExist : Member 'public System.Boolean AutoMapper.Configuration.Internal.PrimitiveHelper.IsListOrDictionaryType(System.Type)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'public System.Linq.Expressions.Expression AutoMapper.Execution.DelegateFactory.GenerateConstructorExpression(System.Type, AutoMapper.ProfileMap)' does not exist in the implementation but it does exist in the contract.
InterfacesShouldHaveSameMembers : Interface member 'public System.Boolean AutoMapper.QueryableExtensions.IExpressionResultConverter.CanGetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.ConstructorParameterMap)' is present in the contract but not in the implementation.
MembersMustExist : Member 'public System.Boolean AutoMapper.QueryableExtensions.IExpressionResultConverter.CanGetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.ConstructorParameterMap)' does not exist in the implementation but it does exist in the contract.
InterfacesShouldHaveSameMembers : Interface member 'public System.Boolean AutoMapper.QueryableExtensions.IExpressionResultConverter.CanGetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.IMemberMap)' is present in the implementation but not in the contract.
InterfacesShouldHaveSameMembers : Interface member 'public System.Boolean AutoMapper.QueryableExtensions.IExpressionResultConverter.CanGetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.PropertyMap)' is present in the contract but not in the implementation.
MembersMustExist : Member 'public System.Boolean AutoMapper.QueryableExtensions.IExpressionResultConverter.CanGetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.PropertyMap)' does not exist in the implementation but it does exist in the contract.
InterfacesShouldHaveSameMembers : Interface member 'public AutoMapper.QueryableExtensions.ExpressionResolutionResult AutoMapper.QueryableExtensions.IExpressionResultConverter.GetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.ConstructorParameterMap)' is present in the contract but not in the implementation.
MembersMustExist : Member 'public AutoMapper.QueryableExtensions.ExpressionResolutionResult AutoMapper.QueryableExtensions.IExpressionResultConverter.GetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.ConstructorParameterMap)' does not exist in the implementation but it does exist in the contract.
InterfacesShouldHaveSameMembers : Interface member 'public AutoMapper.QueryableExtensions.ExpressionResolutionResult AutoMapper.QueryableExtensions.IExpressionResultConverter.GetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.IMemberMap, AutoMapper.QueryableExtensions.LetPropertyMaps)' is present in the implementation but not in the contract.
InterfacesShouldHaveSameMembers : Interface member 'public AutoMapper.QueryableExtensions.ExpressionResolutionResult AutoMapper.QueryableExtensions.IExpressionResultConverter.GetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.PropertyMap, AutoMapper.QueryableExtensions.LetPropertyMaps)' is present in the contract but not in the implementation.
MembersMustExist : Member 'public AutoMapper.QueryableExtensions.ExpressionResolutionResult AutoMapper.QueryableExtensions.IExpressionResultConverter.GetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.PropertyMap, AutoMapper.QueryableExtensions.LetPropertyMaps)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'public System.Boolean AutoMapper.QueryableExtensions.Impl.MemberGetterExpressionResultConverter.CanGetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.ConstructorParameterMap)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'public System.Boolean AutoMapper.QueryableExtensions.Impl.MemberGetterExpressionResultConverter.CanGetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.PropertyMap)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'public AutoMapper.QueryableExtensions.ExpressionResolutionResult AutoMapper.QueryableExtensions.Impl.MemberGetterExpressionResultConverter.GetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.ConstructorParameterMap)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'public AutoMapper.QueryableExtensions.ExpressionResolutionResult AutoMapper.QueryableExtensions.Impl.MemberGetterExpressionResultConverter.GetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.PropertyMap, AutoMapper.QueryableExtensions.LetPropertyMaps)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'public System.Boolean AutoMapper.QueryableExtensions.Impl.MemberResolverExpressionResultConverter.CanGetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.ConstructorParameterMap)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'public System.Boolean AutoMapper.QueryableExtensions.Impl.MemberResolverExpressionResultConverter.CanGetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.PropertyMap)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'public AutoMapper.QueryableExtensions.ExpressionResolutionResult AutoMapper.QueryableExtensions.Impl.MemberResolverExpressionResultConverter.GetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.ConstructorParameterMap)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'public AutoMapper.QueryableExtensions.ExpressionResolutionResult AutoMapper.QueryableExtensions.Impl.MemberResolverExpressionResultConverter.GetExpressionResolutionResult(AutoMapper.QueryableExtensions.ExpressionResolutionResult, AutoMapper.PropertyMap, AutoMapper.QueryableExtensions.LetPropertyMaps)' does not exist in the implementation but it does exist in the contract.
Total Issues: 60
>>>>>>> fail sooner
13 changes: 11 additions & 2 deletions src/AutoMapper/Configuration/CtorParamConfigurationExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ namespace AutoMapper.Configuration
public class CtorParamConfigurationExpression<TSource> : ICtorParamConfigurationExpression<TSource>, ICtorParameterConfiguration
{
public string CtorParamName { get; }
public Type SourceType { get; }

private readonly List<Action<ConstructorParameterMap>> _ctorParamActions = new List<Action<ConstructorParameterMap>>();

public CtorParamConfigurationExpression(string ctorParamName) => CtorParamName = ctorParamName;
public CtorParamConfigurationExpression(string ctorParamName, Type sourceType)
{
CtorParamName = ctorParamName;
SourceType = sourceType;
}

public void MapFrom<TMember>(Expression<Func<TSource, TMember>> sourceMember) =>
_ctorParamActions.Add(cpm => cpm.CustomMapExpression = sourceMember);
Expand All @@ -21,8 +27,11 @@ public void MapFrom<TMember>(Func<TSource, ResolutionContext, TMember> resolver)
_ctorParamActions.Add(cpm => cpm.CustomMapFunction = resolverExpression);
}

public void MapFrom(string sourceMemberName) =>
public void MapFrom(string sourceMemberName)
{
SourceType.GetFieldOrProperty(sourceMemberName);
_ctorParamActions.Add(cpm => cpm.SourceMemberName = sourceMemberName);
}

public void Configure(TypeMap typeMap)
{
Expand Down
2 changes: 1 addition & 1 deletion src/AutoMapper/Configuration/MappingExpressionBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public void ConvertUsing<TTypeConverter>() where TTypeConverter : ITypeConverter

public TMappingExpression ForCtorParam(string ctorParamName, Action<ICtorParamConfigurationExpression<TSource>> paramOptions)
{
var ctorParamExpression = new CtorParamConfigurationExpression<TSource>(ctorParamName);
var ctorParamExpression = new CtorParamConfigurationExpression<TSource>(ctorParamName, SourceType);

paramOptions(ctorParamExpression);

Expand Down