Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>AutoMapper.Extensions.ExpressionMapping</PackageId>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>Marking obsolete methods and classes.</PackageReleaseNotes>
<PackageProjectUrl>https://automapper.org</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>
Expand All @@ -30,11 +32,11 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="[16.0.0,17.0.0)" />
<PackageReference Include="MinVer" Version="6.0.0">
<PackageReference Include="MinVer" Version="7.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.103" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace AutoMapper.Extensions.ExpressionMapping
{
[Obsolete("This class is not intended for public use and may be removed in future versions.")]
public class MapIncludesVisitor : XpressionMapperVisitor
{
public MapIncludesVisitor(IMapper mapper, IConfigurationProvider configurationProvider, Dictionary<Type, Type> typeMappings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ private static TDestDelegate _MapExpression<TSourceDelegate, TDestDelegate>(this
private static MethodInfo GetMapExpressionMethod(this string methodName)
=> typeof(MapperExtensions).GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Static);

[Obsolete("This method is obsolete. Use IMapper.Map(object source, Type sourceType, Type destinationType) instead.")]
public static object MapObject(this IMapper mapper, object obj, Type sourceType, Type destType)
=> "_MapObject".GetMapObjectMethod().MakeGenericMethod
(
Expand Down Expand Up @@ -153,6 +154,7 @@ public static TDestDelegate MapExpression<TSourceDelegate, TDestDelegate>(this I
/// <param name="mapper"></param>
/// <param name="expression"></param>
/// <returns></returns>
[Obsolete("Use ProjectTo with expansions instead of IMapper.MapExpressionAsInclude.")]
public static TDestDelegate MapExpressionAsInclude<TDestDelegate>(this IMapper mapper, LambdaExpression expression)
where TDestDelegate : LambdaExpression
{
Expand All @@ -175,6 +177,7 @@ public static TDestDelegate MapExpressionAsInclude<TDestDelegate>(this IMapper m
/// <param name="mapper"></param>
/// <param name="expression"></param>
/// <returns></returns>
[Obsolete("Use ProjectTo with expansions instead of IMapper.MapExpressionAsInclude.")]
public static TDestDelegate MapExpressionAsInclude<TSourceDelegate, TDestDelegate>(this IMapper mapper, TSourceDelegate expression)
where TSourceDelegate : LambdaExpression
where TDestDelegate : LambdaExpression
Expand Down Expand Up @@ -212,6 +215,7 @@ public static ICollection<TDestDelegate> MapExpressionList<TDestDelegate>(this I
/// <param name="mapper"></param>
/// <param name="collection"></param>
/// <returns></returns>
[Obsolete("Use ProjectTo with expansions instead of IMapper.MapIncludesList.")]
public static ICollection<TDestDelegate> MapIncludesList<TSourceDelegate, TDestDelegate>(this IMapper mapper, ICollection<TSourceDelegate> collection)
where TSourceDelegate : LambdaExpression
where TDestDelegate : LambdaExpression
Expand All @@ -224,6 +228,7 @@ public static ICollection<TDestDelegate> MapIncludesList<TSourceDelegate, TDestD
/// <param name="mapper"></param>
/// <param name="collection"></param>
/// <returns></returns>
[Obsolete("Use ProjectTo with expansions instead of IMapper.MapIncludesList.")]
public static ICollection<TDestDelegate> MapIncludesList<TDestDelegate>(this IMapper mapper, IEnumerable<LambdaExpression> collection)
where TDestDelegate : LambdaExpression
=> collection?.Select(mapper.MapExpressionAsInclude<TDestDelegate>).ToList();
Expand All @@ -235,6 +240,7 @@ public static ICollection<TDestDelegate> MapIncludesList<TDestDelegate>(this IMa
/// <param name="infoDictionary"></param>
/// <param name="typeMappings"></param>
/// <returns></returns>
[Obsolete("This method will be moved to a public class meant for internal use.")]
public static List<ParameterExpression> GetDestinationParameterExpressions(this LambdaExpression expression, MapperInfoDictionary infoDictionary, Dictionary<Type, Type> typeMappings)
{
foreach (var p in expression.Parameters.Where(p => !infoDictionary.ContainsKey(p)))
Expand All @@ -253,6 +259,7 @@ public static List<ParameterExpression> GetDestinationParameterExpressions(this
/// <param name="typeMappings"></param>
/// <param name="configurationProvider"></param>
/// <returns></returns>
[Obsolete("This method is not being used and will be removed.")]
public static Dictionary<Type, Type> AddTypeMapping<TSource, TDest>(this Dictionary<Type, Type> typeMappings, IConfigurationProvider configurationProvider)
=> typeMappings == null
? throw new ArgumentException(Properties.Resources.typeMappingsDictionaryIsNull)
Expand Down Expand Up @@ -293,6 +300,7 @@ private static void AddUnderlyingTypes(this Dictionary<Type, Type> typeMappings,
/// <param name="sourceType"></param>
/// <param name="destType"></param>
/// <returns></returns>
[Obsolete("This method will be moved to a public class meant for internal use.")]
public static Dictionary<Type, Type> AddTypeMapping(this Dictionary<Type, Type> typeMappings, IConfigurationProvider configurationProvider, Type sourceType, Type destType)
{
if (typeMappings == null)
Expand Down Expand Up @@ -345,6 +353,7 @@ void AddTypeMaps(TypeMap typeMap)
/// <param name="typeMappings"></param>
/// <param name="sourceType"></param>
/// <returns></returns>
[Obsolete("This method will be moved to a public class meant for internal use.")]
public static Type ReplaceType(this Dictionary<Type, Type> typeMappings, Type sourceType)
{
if (sourceType.IsArray)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace AutoMapper.Extensions.ExpressionMapping.Structures
{
public class MapperInfo
{
[Obsolete("Use MapperInfo(ParameterExpression newParameter, Type sourceType, Type destType).")]
public MapperInfo()
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace AutoMapper.Extensions.ExpressionMapping
{
public class XpressionMapperVisitor : ExpressionVisitor
{
[Obsolete("This constructor is obsolete. Use XpressionMapperVisitor(IMapper mapper, Dictionary<Type, Type> typeMappings).")]
public XpressionMapperVisitor(IMapper mapper, IConfigurationProvider configurationProvider, Dictionary<Type, Type> typeMappings)
{
Mapper = mapper;
Expand All @@ -21,6 +22,14 @@ public XpressionMapperVisitor(IMapper mapper, IConfigurationProvider configurati
ConfigurationProvider = configurationProvider;
}

public XpressionMapperVisitor(IMapper mapper, Dictionary<Type, Type> typeMappings)
{
Mapper = mapper;
TypeMappings = typeMappings;
InfoDictionary = new MapperInfoDictionary(new ParameterExpressionEqualityComparer());
ConfigurationProvider = mapper.ConfigurationProvider;
}

public MapperInfoDictionary InfoDictionary { get; }

public Dictionary<Type, Type> TypeMappings { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<PropertyGroup>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net8.0;net10.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net481;net8.0;net9.0;net10.0</TargetFrameworks>

<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="Microsoft.OData.Edm" Version="7.22.0" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.v3" Version="3.2.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down