Upgrading AutoMapper 8 to 9
Breaking8.1.1 → 9.0.0Breaking5New5Changed6Fixed3Other3
BreakingUpgrade verdict
3 breaking changes.
In plain terms
- You can no longer map objects using the old static Mapper.Map calls or dynamic mapping; you must use an IMapper instance instead.
- Removes dynamic maps.
- Removes the static API.
Must act 3 items need code or config changes
AutoMapper publishes an official migration guide for version 9. It covers more than the release notes do.
9.0 upgrade guide ↗What you must change
Breaking3
Removes the static mapper (Mapper.Map) and dynamic mapping entirely.
Mapper.MapRemoves dynamic maps.
Removes the static API.
API changes
Generated by DepDelta from published .NET assemblies. Not mixed with prose notes.
- removed:
ctor MapRequest(TypePair requestedTypes, TypePair runtimeTypes, ITypeMapConfiguration inlineConfig, IMemberMap memberMap = …) - removed:
ctor TypeMapFactory() - removed:
method IConfigurationProvider.ResolveTypeMap(Type sourceType, Type destinationType, ITypeMapConfiguration inlineConfiguration): TypeMap - removed:
method IConfigurationProvider.ResolveTypeMap(TypePair typePair, ITypeMapConfiguration inlineConfiguration): TypeMap - removed:
method IMapperConfigurationExpression.AddProfiles(Assembly[] assembliesToScan): void - removed:
method IMapperConfigurationExpression.AddProfiles(IEnumerable<Assembly> assembliesToScan): void - removed:
method IMapperConfigurationExpression.AddProfiles(IEnumerable<Type> typesFromAssembliesContainingProfiles): void - removed:
method IMapperConfigurationExpression.AddProfiles(IEnumerable<string> assemblyNamesToScan): void - removed:
method IMapperConfigurationExpression.AddProfiles(Type[] typesFromAssembliesContainingProfiles): void - removed:
method IMapperConfigurationExpression.AddProfiles(string[] assemblyNamesToScan): void - removed:
method IMappingOperationOptions.ConfigureMap(): IMappingExpression<TSource, TDestination> - removed:
method IMappingOperationOptions.ConfigureMap(MemberList memberList): IMappingExpression<TSource, TDestination> - removed:
method IProfileExpression.AddConditionalObjectMapper(): IConditionalObjectMapper - removed:
method MapperConfiguration.ResolveTypeMap(Type sourceType, Type destinationType, ITypeMapConfiguration inlineConfiguration): TypeMap - removed:
method MapperConfiguration.ResolveTypeMap(TypePair typePair, ITypeMapConfiguration inlineConfiguration): TypeMap - removed:
method MappingOperationOptions.ConfigureMap(): IMappingExpression<TSource, TDestination> - removed:
method MappingOperationOptions.ConfigureMap(MemberList memberList): IMappingExpression<TSource, TDestination> - removed:
method Profile.AddConditionalObjectMapper(): IConditionalObjectMapper - removed:
method ProfileMap.CreateConventionTypeMap(TypePair types, IConfigurationProvider configurationProvider): TypeMap - removed:
method ProfileMap.CreateInlineMap(TypePair types, IConfigurationProvider configurationProvider): TypeMap - removed:
method ProfileMap.IsConventionMap(TypePair types): bool - removed:
property IMapperConfigurationExpression.CreateMissingTypeMaps: bool? { get; set; } - removed:
property IProfileExpression.ValidateInlineMaps: bool? { get; set; } - removed:
property MapRequest.InlineConfig: ITypeMapConfiguration { get; } - removed:
property MappingOperationOptions.InlineConfiguration: ITypeMapConfiguration { get; set; } - removed:
property Profile.CreateMissingTypeMaps: bool? { get; set; } - removed:
property Profile.ValidateInlineMaps: bool? { get; set; } - removed:
property ProfileMap.CreateMissingTypeMaps: bool { get; } - removed:
property ProfileMap.TypeConfigurations: IEnumerable<IConditionalObjectMapper> { get; } - removed:
property ProfileMap.ValidateInlineMaps: bool { get; } - removed:
property TypeMap.IsConventionMap: bool { get; set; } - removed:
static method Mapper.AssertConfigurationIsValid(): void - removed:
static method Mapper.Initialize(Action<IMapperConfigurationExpression> config): void - removed:
static method Mapper.Initialize(MapperConfigurationExpression config): void - removed:
static method Mapper.Reset(): void - removed:
static property Mapper.Configuration: IConfigurationProvider { get; } - removed:
static property Mapper.Instance: IMapper { get; } - changed:
class TypeMapFactory → static class TypeMapFactory - changed:
method IMappingAction.Process(TSource source, TDestination destination): void → method IMappingAction.Process(TSource source, TDestination destination, ResolutionContext context): void - changed:
method TypeMapFactory.CreateTypeMap(Type sourceType, Type destinationType, ProfileMap options): TypeMap → static method TypeMapFactory.CreateTypeMap(Type sourceType, Type destinationType, ProfileMap options): TypeMap - changed:
static method Mapper.Map(object source, Type sourceType, Type destinationType): object → method Mapper.Map(object source, Type sourceType, Type destinationType): object - changed:
static method Mapper.Map(object source, Type sourceType, Type destinationType, Action<IMappingOperationOptions> opts): object → method Mapper.Map(object source, Type sourceType, Type destinationType, Action<IMappingOperationOptions> opts): object - changed:
static method Mapper.Map(object source, object destination, Type sourceType, Type destinationType): object → method Mapper.Map(object source, object destination, Type sourceType, Type destinationType): object - changed:
static method Mapper.Map(object source, object destination, Type sourceType, Type destinationType, Action<IMappingOperationOptions> opts): object → method Mapper.Map(object source, object destination, Type sourceType, Type destinationType, Action<IMappingOperationOptions> opts): object - changed:
static method Mapper.Map<TDestination>(object source): TDestination → method Mapper.Map(object source, object destination, Type sourceType, Type destinationType, ResolutionContext context, IMemberMap memberMap): object - changed:
static method Mapper.Map<TDestination>(object source, Action<IMappingOperationOptions> opts): TDestination → method Mapper.Map<TDestination>(object source): TDestination - changed:
static method Mapper.Map<TSource, TDestination>(TSource source): TDestination → method Mapper.Map<TDestination>(object source, Action<IMappingOperationOptions> opts): TDestination - changed:
static method Mapper.Map<TSource, TDestination>(TSource source, Action<IMappingOperationOptions<TSource, TDestination>> opts): TDestination → method Mapper.Map<TSource, TDestination>(TSource source): TDestination - changed:
static method Mapper.Map<TSource, TDestination>(TSource source, TDestination destination): TDestination → method Mapper.Map<TSource, TDestination>(TSource source, Action<IMappingOperationOptions<TSource, TDestination>> opts): TDestination - changed:
static method Mapper.Map<TSource, TDestination>(TSource source, TDestination destination, Action<IMappingOperationOptions<TSource, TDestination>> opts): TDestination → method Mapper.Map<TSource, TDestination>(TSource source, TDestination destination): TDestination - added:
method Mapper.Map<TSource, TDestination>(TSource source, TDestination destination, Action<IMappingOperationOptions<TSource, TDestination>> opts): TDestination - added:
method Mapper.Map<TSource, TDestination>(TSource source, TDestination destination, ResolutionContext context, IMemberMap memberMap): TDestination - added:
method Mapper.ProjectTo<TDestination>(IQueryable source, IDictionary<string, object> parameters, string[] membersToExpand): IQueryable<TDestination> - added:
method Mapper.ProjectTo<TDestination>(IQueryable source, object parameters, Expression<Func<TDestination, object>>[] membersToExpand): IQueryable<TDestination> - added:
method ProfileMap.MapDestinationCtorToSource(TypeMap typeMap, ConstructorInfo destCtor, TypeDetails sourceTypeInfo, List<ICtorParameterConfiguration> ctorParamConfigurations): bool - added:
method ProfileMap.MapDestinationPropertyToSource(TypeDetails sourceTypeInfo, Type destType, Type destMemberType, string destMemberInfo, LinkedList<MemberInfo> members): bool - added:
property ContextCacheKey.Source: object { get; } - added:
property Mapper.ConfigurationProvider: IConfigurationProvider { get; } - added:
property Mapper.ServiceCtor: Func<Type, object> { get; }
- removed:
method MapperConfigurationExpression.AddProfiles(Assembly[] assembliesToScan): void - removed:
method MapperConfigurationExpression.AddProfiles(IEnumerable<Assembly> assembliesToScan): void - removed:
method MapperConfigurationExpression.AddProfiles(IEnumerable<Type> typesFromAssembliesContainingProfiles): void - removed:
method MapperConfigurationExpression.AddProfiles(IEnumerable<string> assemblyNamesToScan): void - removed:
method MapperConfigurationExpression.AddProfiles(Type[] typesFromAssembliesContainingProfiles): void - removed:
method MapperConfigurationExpression.AddProfiles(string[] assemblyNamesToScan): void - removed:
property IProfileConfiguration.CreateMissingTypeMaps: bool? { get; } - removed:
property IProfileConfiguration.TypeConfigurations: IEnumerable<IConditionalObjectMapper> { get; } - removed:
property IProfileConfiguration.ValidateInlineMaps: bool? { get; } - added:
property CtorParamConfigurationExpression.CtorParamName: string { get; } - added:
property ICtorParameterConfiguration.CtorParamName: string { get; }
- added:
static method ExpressionFactory.Using(Expression disposable, Expression body): Expression
- removed:
class ConditionalObjectMapper implements IConditionalObjectMapper - removed:
ctor ConditionalObjectMapper() - removed:
interface IConditionalObjectMapper - removed:
method ConditionalObjectMapper.IsMatch(TypePair typePair): bool - removed:
method IConditionalObjectMapper.IsMatch(TypePair context): bool - removed:
property ConditionalObjectMapper.Conventions: ICollection<Func<TypePair, bool>> { get; } - removed:
property IConditionalObjectMapper.Conventions: ICollection<Func<TypePair, bool>> { get; } - removed:
static class ConventionGeneratorExtensions - removed:
static method ConventionGeneratorExtensions.Where(IConditionalObjectMapper self, Func<Type, Type, bool> condition): IConditionalObjectMapper
- removed:
static method Extensions.Map<TSource, TDestination>(IQueryable<TSource> sourceQuery, IQueryable<TDestination> destQuery): IQueryable<TDestination> - removed:
static method Extensions.ProjectTo<TDestination>(IQueryable source, Expression<Func<TDestination, object>>[] membersToExpand): IQueryable<TDestination> - removed:
static method Extensions.ProjectTo<TDestination>(IQueryable source, IDictionary<string, object> parameters, string[] membersToExpand): IQueryable<TDestination> - removed:
static method Extensions.ProjectTo<TDestination>(IQueryable source, object parameters, Expression<Func<TDestination, object>>[] membersToExpand): IQueryable<TDestination>