-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update assembly infor * update license and version * Add automapper 6.2.2
- Loading branch information
1 parent
95df4e8
commit 9754fea
Showing
170 changed files
with
14,528 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace AutoMapper | ||
{ | ||
using Validator = Action<ValidationContext>; | ||
|
||
public class AdvancedConfiguration | ||
{ | ||
private readonly List<Validator> _validators = new List<Validator>(); | ||
private readonly IList<Action<IConfigurationProvider>> _beforeSealActions = new List<Action<IConfigurationProvider>>(); | ||
public IEnumerable<Action<IConfigurationProvider>> BeforeSealActions => _beforeSealActions; | ||
|
||
/// <summary> | ||
/// Add Action called against the IConfigurationProvider before it gets sealed | ||
/// </summary> | ||
public void BeforeSeal(Action<IConfigurationProvider> action) => _beforeSealActions.Add(action); | ||
|
||
/// <summary> | ||
/// Add an action to be called when validating the configuration. | ||
/// </summary> | ||
/// <param name="validator">the validation callback</param> | ||
public void Validator(Validator validator) => _validators.Add(validator); | ||
|
||
public bool AllowAdditiveTypeMapCreation { get; set; } | ||
|
||
/// <summary> | ||
/// How many levels deep should AutoMapper try to inline the execution plan for child classes. | ||
/// See <a href="http://automapper.readthedocs.io/en/latest/Understanding-your-mapping.html">the wiki</a> for details. | ||
/// </summary> | ||
public int MaxExecutionPlanDepth { get; set; } = 1; | ||
|
||
internal Validator[] GetValidators() => _validators.ToArray(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Reflection; | ||
using System.Resources; | ||
using System.Runtime.InteropServices; | ||
using System.Security; | ||
|
||
[assembly: CLSCompliant(true)] | ||
[assembly: AllowPartiallyTrustedCallers] | ||
[assembly: ComVisible(false)] | ||
[assembly: NeutralResourcesLanguage("en")] | ||
[assembly: Guid("b38fd93e-7dc6-43d3-9081-b2f907994b74")] | ||
[assembly: AssemblyVersion("1.0.0")] | ||
[assembly: AssemblyFileVersion("6.2.2")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Summary>A convention-based object-object mapper.</Summary> | ||
<Description>A convention-based object-object mapper.</Description> | ||
<TargetFrameworks>netstandard2.0</TargetFrameworks> | ||
<AssemblyName>Microsoft.Azure.PowerShell.AutoMapper</AssemblyName> | ||
<AssemblyOriginatorKeyFile>..\..\src\MSSharedLibKey.snk</AssemblyOriginatorKeyFile> | ||
<SignAssembly>true</SignAssembly> | ||
<Version>6.2.2</Version> | ||
<DelaySign>true</DelaySign> | ||
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign> | ||
<PackageId>Microsoft.Azure.PowerShell.AutoMapper</PackageId> | ||
<PackageProjectUrl>https://automapper.org</PackageProjectUrl> | ||
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile> | ||
<RepositoryType>git</RepositoryType> | ||
<RepositoryUrl>https://github.com/AutoMapper/AutoMapper</RepositoryUrl> | ||
<PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder> | ||
<NoWarn>$(NoWarn);1591</NoWarn> | ||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" /> | ||
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="licenses\LICENSE.txt" Pack="true" PackagePath="LICENSE.txt"/> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace AutoMapper | ||
{ | ||
public class AutoMapperConfigurationException : Exception | ||
{ | ||
public TypeMapConfigErrors[] Errors { get; } | ||
public TypePair? Types { get; } | ||
public PropertyMap PropertyMap { get; set; } | ||
|
||
public class TypeMapConfigErrors | ||
{ | ||
public TypeMap TypeMap { get; } | ||
public string[] UnmappedPropertyNames { get; } | ||
public bool CanConstruct { get; } | ||
|
||
public TypeMapConfigErrors(TypeMap typeMap, string[] unmappedPropertyNames, bool canConstruct) | ||
{ | ||
TypeMap = typeMap; | ||
UnmappedPropertyNames = unmappedPropertyNames; | ||
CanConstruct = canConstruct; | ||
} | ||
} | ||
|
||
public AutoMapperConfigurationException(string message) | ||
: base(message) | ||
{ | ||
} | ||
|
||
protected AutoMapperConfigurationException(string message, Exception inner) | ||
: base(message, inner) | ||
{ | ||
} | ||
|
||
public AutoMapperConfigurationException(TypeMapConfigErrors[] errors) => Errors = errors; | ||
|
||
public AutoMapperConfigurationException(TypePair types) => Types = types; | ||
|
||
public override string Message | ||
{ | ||
get | ||
{ | ||
if (Types != null) | ||
{ | ||
var message = | ||
string.Format( | ||
"The following property on {0} cannot be mapped: \n\t{2} \nAdd a custom mapping expression, ignore, add a custom resolver, or modify the destination type {1}.", | ||
Types?.DestinationType.FullName, Types?.DestinationType.FullName, | ||
PropertyMap?.DestinationProperty.Name); | ||
|
||
message += "\nContext:"; | ||
|
||
Exception exToUse = this; | ||
while (exToUse != null) | ||
{ | ||
if (exToUse is AutoMapperConfigurationException configExc) | ||
{ | ||
message += configExc.PropertyMap == null | ||
? $"\n\tMapping from type {configExc.Types?.SourceType.FullName} to {configExc.Types?.DestinationType.FullName}" | ||
: $"\n\tMapping to property {configExc.PropertyMap.DestinationProperty.Name} from {configExc.Types?.SourceType.FullName} to {configExc.Types?.DestinationType.FullName}"; | ||
} | ||
|
||
exToUse = exToUse.InnerException; | ||
} | ||
|
||
return message + "\n" + base.Message; | ||
} | ||
if (Errors != null) | ||
{ | ||
var message = | ||
new StringBuilder( | ||
"\nUnmapped members were found. Review the types and members below.\nAdd a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type\nFor no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters\n"); | ||
|
||
foreach (var error in Errors) | ||
{ | ||
var len = error.TypeMap.SourceType.FullName.Length + | ||
error.TypeMap.DestinationType.FullName.Length + 5; | ||
|
||
message.AppendLine(new string('=', len)); | ||
message.AppendLine(error.TypeMap.SourceType.Name + " -> " + error.TypeMap.DestinationType.Name + | ||
" (" + | ||
error.TypeMap.ConfiguredMemberList + " member list)"); | ||
message.AppendLine(error.TypeMap.SourceType.FullName + " -> " + | ||
error.TypeMap.DestinationType.FullName + " (" + | ||
error.TypeMap.ConfiguredMemberList + " member list)"); | ||
message.AppendLine(); | ||
|
||
if (error.UnmappedPropertyNames.Any()) | ||
{ | ||
message.AppendLine("Unmapped properties:"); | ||
foreach (var name in error.UnmappedPropertyNames) | ||
{ | ||
message.AppendLine(name); | ||
} | ||
} | ||
if (!error.CanConstruct) | ||
{ | ||
message.AppendLine("No available constructor."); | ||
} | ||
} | ||
return message.ToString(); | ||
} | ||
return base.Message; | ||
} | ||
} | ||
|
||
public override string StackTrace | ||
{ | ||
get | ||
{ | ||
if (Errors != null) | ||
return string.Join(Environment.NewLine, | ||
base.StackTrace | ||
.Split(new[] {Environment.NewLine}, StringSplitOptions.None) | ||
.Where(str => !str.TrimStart().StartsWith("at AutoMapper.")) | ||
.ToArray()); | ||
|
||
return base.StackTrace; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
using System; | ||
#if !DEBUG | ||
using System.Linq; | ||
#endif | ||
|
||
namespace AutoMapper | ||
{ | ||
public class AutoMapperMappingException : Exception | ||
{ | ||
private readonly string _message; | ||
|
||
// | ||
// For guidelines regarding the creation of new exception types, see | ||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp | ||
// and | ||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp | ||
// | ||
|
||
public AutoMapperMappingException() | ||
{ | ||
} | ||
|
||
public AutoMapperMappingException(string message) | ||
: base(message) => _message = message; | ||
|
||
public AutoMapperMappingException(string message, Exception innerException) | ||
: base(message, innerException) => _message = message; | ||
|
||
public AutoMapperMappingException(string message, Exception innerException, TypePair types) | ||
: this(message, innerException) => Types = types; | ||
|
||
public AutoMapperMappingException(string message, Exception innerException, TypePair types, TypeMap typeMap) | ||
: this(message, innerException, types) => TypeMap = typeMap; | ||
|
||
public AutoMapperMappingException(string message, Exception innerException, TypePair types, TypeMap typeMap, PropertyMap propertyMap) | ||
: this(message, innerException, types, typeMap) => PropertyMap = propertyMap; | ||
|
||
public TypePair? Types { get; set; } | ||
public TypeMap TypeMap { get; set; } | ||
public PropertyMap PropertyMap { get; set; } | ||
|
||
public override string Message | ||
{ | ||
get | ||
{ | ||
var message = _message; | ||
var newLine = Environment.NewLine; | ||
if (Types?.SourceType != null && Types?.DestinationType != null) | ||
{ | ||
message = message + newLine + newLine + "Mapping types:"; | ||
message += newLine + | ||
$"{Types?.SourceType.Name} -> {Types?.DestinationType.Name}"; | ||
message += newLine + | ||
$"{Types?.SourceType.FullName} -> {Types?.DestinationType.FullName}"; | ||
} | ||
if (TypeMap != null) | ||
{ | ||
message = message + newLine + newLine + "Type Map configuration:"; | ||
message += newLine + | ||
$"{TypeMap.SourceType.Name} -> {TypeMap.DestinationType.Name}"; | ||
message += newLine + | ||
$"{TypeMap.SourceType.FullName} -> {TypeMap.DestinationType.FullName}"; | ||
} | ||
if (PropertyMap != null) | ||
{ | ||
message = message + newLine + newLine + "Property:"; | ||
message += newLine + | ||
$"{PropertyMap.DestinationProperty.Name}"; | ||
} | ||
|
||
return message; | ||
} | ||
} | ||
|
||
#if !DEBUG | ||
public override string StackTrace | ||
{ | ||
get | ||
{ | ||
return string.Join(Environment.NewLine, | ||
base.StackTrace | ||
.Split(new[] {Environment.NewLine}, StringSplitOptions.None) | ||
.Where(str => !str.TrimStart().StartsWith("at AutoMapper."))); | ||
} | ||
} | ||
#endif | ||
} | ||
} |
Oops, something went wrong.