Releases: LuckyPennySoftware/AutoMapper
4.0.1
4.0.0
As part of this release we had 198 commits which resulted in 77 issues being closed.
This release supports a wide variety of platforms, and consolidates the assemblies so that each platform only references one assembly. It supports:
- .NET 4.0 +
- Silverlight 5+
- Windows Phone 8
- Windows Phone 8.1
- netcore45 apps
- DNX 4.6
- Anything that works with "dotnet"
Features
- #786 Allow clearing of the default prefixes
- #785 Expose a filter for the properties/fields to be mapped
- #779 Generic type converter closes #774
- #778 UseAsDataSource with PR #649 expression fix
- #774 Please add support for generic version of TypeConverter
- #767 Internal properties mapping and BindingFlags (see #785)
- #697 Please support Windows 10 with Automapper
- #688 Nested mapping projections not respecting explicit expansions
- #668 Support AutoMapper on CoreCLR
- #654 Support constructor parameter mappings for LINQ expressions
- #633 Mapping through constructor doesn't consider custom member mappings (see #654)
- #630 IQueryable extentions. Project Method
- #578 Remove default Prefixes and Postfixes (see #786)
Improvements
- #801 Fixes Include Seal() Problems #762 #683
- #792 Exclude object methods
- #782 Check if we are able to construct the destination object
- #781 Dynamically map arrays
- #780 Nullable int to nullable enum
- #777 NullReferenceException when mapping nullable int to nullable enum
- #771 Return also methods from base types when looking for source members
- #770 Support multidimensional arrays
- #769 Mapping a collection from an abstract base class via "Get" convention fails
- #766 Resolve read-only filed mapping bug
- #765 Unable to map type with read-only filed
- #762 Polymorphic collections example does not work in latest 4.0 release.
- #759 The expression mapper doesn't respect ConstructorParameterMaps; #654
- #755 Possibility to define the MapFrom also by a string
- #750 Nested mapping projections with explicit expanding bug 688
- #749 AutoMapper.targets causing duplicate item error using Web Publishing
- #743 Enum to nullable enum
- #741 Non existing property bug 733
- #733 Better error message when cannot find property
- #724 FindTypeMapFor ignores type parameters when src/dest objects passed
- #718 Slow Initialization
- #712 AutoMapper doesn't support multi-dimensional arrays
- #710 Enum -> Enum? mapping fails
- #687 No .pdb files in nuget package
- #683 IncludeBase must come before base overrides
- #669 Automapper on 64 bit device with Xamarin Unified
- #667 Error while building web application and class library using msbuild
- #660 AssertConfigurationIsValid collect all errors rather than throw first one
- #649 Fix ExpressionMapper error for sub property expression conversion
- #648 Mapping Expressions with ICollection
- #646 Nested Project().To(null, params string[] membersToExpand). How to?
- #628 DynamicMap doesn't map arrays
- #625 ConstructUsing does not throw exception or gives warning when null returned
- #592 Support public readonly fields
- #573 AutoMapperMappingException.Message can throw Exception
- #566 [Feature] Add Global Ignore By Property Type
- #565 Guidance on configuration is fractured
- #561 Redundant IProjectionExpression, use ProjectTo<>() instead of Project().To<>()
- #542 Related to issue #91, Source has no property named Type, Target does have property name Type
Bugs
- #798 IEnumerable to ISet
- #797 DynamicMap threading issues
- #794 A passing test for #154
- #789 Only apply EnumerableMapper to IList existing destination
- #784 Only use the AssignableArrayMapper if the elements of the arrays are …
- #753 Call the options after/before hooks only for the root map operation
- #742 MapFrom subquery unexpected (incorrect) result
- #740 Enum to string bug 720
- #738 Int to nullable decimal bug 732
- #734 AssertConfigurationIsValid hangs on recursive classes.
- #732 int to nullable decimal fails
- #723 .Include<> regression between 4.0-cli1052 and 4.0-cli1053 for dynamic proxies
- #720 Enums unhelpfully converted to strings, in object-valued property, even when explicitly mapped
- #674 after map action with nested objects
- #620 Threading Issue when CreateMissingTypeMaps option is true
- #618 Mapper.CreateMap<Self, Self> ignores nullability rules on collection properties
- #557 Behaviour changed in 3.2.1, DestinationValue not null when no Destination object passed
- #555 Cannot map type property resulting from a where
- #154 Incorrect constructor is picked when the ctor parameter name is 'type', resulting in an InvalidCastException.
- #28 When a target type property is of ISet, the CollectionMapper incorrectly attempts to set it to a List
Where to get it
You can download this release from nuget
3.3.1
3.3.0
As part of this release we had 36 issues closed.
Features
- Provide option for custom constructor for LINQ projection#560
- Open Generic mappings#549
- Support string conversion in LINQ projections#545
- Added Functionality to Support Web Api expands on Projections#520
- Request: Mapper.Map() callbacks.#503
- Missing feature of handling enum to string mappings in queryable projections#494
- Replace member names with Mapper.Initialize#479
- Partial Aliases - Need to replace characters in member names#471
- Allow parameterizing LINQ queries#393
- Support converting expression trees#294
- Configuration setting: allow public vs. internal properties to map.#218
- Support open generic types#59
Improvements
- Mapper.Reset does not clear the Project().To() expression trees.#614
- AddGlobalIgnore does not work when the property name exists on both source and destination, but types are not compatible.#585
- Addressing issues with ExpressionMapper logic.#584
- Work around xunit issue which drops everything after dashes.#564
- Support nullable destination when using custom MapFrom#559
- Inheritance Include with Unincluded inherited mappings#537
- Expose TypeMap in MappingExpression#531
- Automapper projection don't support custom type converters#522
- Fixed #511 - error when trying to map to a ReadOnlyCollection at top-level (i.e. not a property)#512
- Mapping List to ReadOnlyCollection no longer works#511
- Non Generic Version of .UseDestinationValue#509
- Support NullSubstitute in LINQ expressions#506
- Inheritance Maps specified from Derived Class#456
- NotSupportedException on clear in ListSourceMapper #404
Bugs
- Automapper 3.2.1 and appharbor -> failure#609
- Fix Automapper.targets to not use Content type item#581
- AssertConfigurationIsValid fails for destination overrides (As)#574
- .targets file causes AutoMapper to be included by Web Publishing#556
- Fixed #511 - error when trying to map to a ReadOnlyCollection at top-level (i.e. not a property)#532
- Null array properties behaviour changes 3.0 -> 3.1#526
- Using AutoMapper breaks design time experience in Expression Blend #524
- AssertConfigurationIsValid ignore provided typemaps for DryRun#505
- In post 3.0.0 builds, using NullSubstitute results in model type name being substituted instead of value provided#469
Where to get it
You can download this release from nuget
3.2.1
This is a patch release to address the PCL issues of WPA81 only being available in VS2013 Update 2 RC.
As part of this release we had 4 commits which resulted in 3 issues being closed.
Patch release
Bugs
#499 Automapper 3.2.0 through Nuget is not CLS-Compliant
I commmented on issue #464 but it didn't open the issue also it's for 3.1.1 and this is for 3.2.0
Here is my comment
I just updated Automapper to 3.2.0 through Nuget and I'm getting errors that AutoMapper.Profile is not CLS-Compliant when I extend it in my VB.net project.
I see that the Common Assembly Info has CLS Compliance so unless Nuget is pointing to the wrong version I don't really know what's going on here.
#498 ForMember breaks ReSharper after upgrade to 3.2
In VS2013:
Mapper.CreateMap<S,D>()
.ForMember ( d=>d.Something, o=>o.MapFrom( s=> s.Value ) );
indicates (red squiggle) that d.Something is not valid "Cannot resolve symbol Something". It complies ok and runs ok.
What am I missing?
Thanks
#381 ForMember angering ReSharper? - Non-existing PCL profile on client machine causing compile/R# errors
I'm trying to use the ForMember to add an ignore mapping to an object. ReSharper refuses to believe that ".ForMember(x => x.Thing, o => o.Ignore())" exists, though it's fine with using the string varient of that method. I'd rather use the former for obvious reasons, but seem to be stuck using the latter for now.
Note it, will COMPILE the other way, ReSharper just doesn't seem able to grok the Expression using the other one. Using 3.0.0 NuGet package.
Where to get it
You can download this release from:
3.2.0
AutoMapper 3.2.0 now supports the following target platforms:
- .NET 4+
- Silverlight 5
- Windows Phone 8+
- Windows 8+
- Windows Universal Apps (WPA81)
- Xamarin MonoDroid
- Xamarin MonoTouch
As part of this release we had 66 commits which resulted in 48 issues being closed.
Features
#487 Queryable mapping bug
Test cases and partial fix for mapping child collections. See http://stackoverflow.com/q/20046521/311289 for a bigger description.
#446 Evaluate IMemberConfigurationExpression conditions before resolve value
Hi,
it would be nice if conditions are evaluated before ResolveValue is called in order to avoid executing code (i.e. calling the getter of the underlying property) which won't be needed anyway because a condition will return false.
Specifing IMemberConfigurationExpression.Ignore() would work since this is evaluated before resolving the value but my use case depends on dynamic variables.
Source:
TypeMapObjectMapperRegistry::PropertyMapMappingStrategy:MapPropertyValue()
Content trimmed. See full issue
#429 Nuget ios version 3.1.0 does not compile for device
Setup:
- xamarin ios 7.0.x, xamarin ios vs2012 1.8
- create a new ios helloworld project, reference Automapper nuget
- In MyViewController add
public class Test1 { public string Value1 { get; set; } }
public class Test2 { public string Value1 { get; set; } }
- In ViewDidLoad add
Content trimmed. See full issue
#422 support for optional args
added support for optional args with default values
#409 Handle NHibernate proxies of Abstract Type
Hi, I would like to be able to call
Mapper.Map<Animal, AnimalDto>(animal);
Where Both Animal and AnimalDto are abstract classes AND animal is in fact a proxy to a NHibernate object. I would imagine this working by using Mappings similar to this:
Mapper.CreateMap<Animal, AnimalDto>()
.PreMap(animalProxy => Helper.CastToEntity(animalProxy))
.Include<Cat, CatDto>
.Include<Dog, DogDto>
Content trimmed. See full issue
#354 IgnoreMap attribute
We use Automapper to map between models and view models. In some of our view models we want to map in a value from a model but never want it to be mapped back into the model itself. These values/properties are used on the view model in a read only fashion and considered reference only. We were hoping that by adding the ignore attribute to our view model would allow us to map a value in from the model but not back into the model but it appears to work both ways. We use the map config to write ignore() for each of these values but would rather use attributes. How about an overload to the ignore map attribute that allows us to configure the allowed or blocked direction of the map operation?
#256 AutoMapper caching objects when mapping twice
When you have a tree heirarcy of objects, and the same value exists in two places of the tree (but with different child values), and when mapping the second instance of the item - it uses the child values of the first instance, instead of re-evaluating what the child values should be.
Here is my example:
class Tag {
int Id {get; set;}
string Name {get; set;}
IEnumerable<Tag> ChildTags {get; set;}
}
public void Test()
Content trimmed. See full issue
#255 Are there any plans to release WinRT version ?
I'm building Metro app based on C#/XMAL approach and I would really like to use automapper. So, is there a chance to get it ? Currently I'm not able to add it the project due to that automapper is not complied against winRT.
Preferable : it would be nice to get it thru nuget package.
#254 Support for yielding records from DataReaderMapper rather than using a list
For the most part, the DataReaderMapper has always worked well for me. The use of a List rather than yielding records was never that big of a deal for the majority of my typical scenarios. However, I finally have a legitimate need for yielding the records due to some rather large result sets.
You might decide against merging this, but I wanted to offer it since others have asked for this ability. All of the existing unit tests pass and I also tested the changes in my own projects. Depending on how AutoMapper is being applied to data readers, there are some scenarios that could be problematic due to deferred execution.
For example, code written such as this would now fail because the reader will already be closed when iteration of the enumerable begins. The reader will not actually be processed until deferred execution is triggered.
public IEnumerable<Person> GetAllPersonRecords()
{
using (var connection = CreateConnection())
using (var command = CreateCommand())Content trimmed. See full issue
#247 Support Entity Framework in CreateMapExpression
Hello,
I have made changes to enhance the support for building queries that translate to SQL using the Entity Framework.
- Allow nested queries that can be mapped to SQL.
- Added support for mapping to Arrays using CreateMapExpression.
- Created Unit Test cases for Linq Expressions.
Mapper.CreateMap<Entity, EntityViewModel>()
.ForMember(m => m.SubEntityNames, o => o.MapFrom(f => f.SubEntities.Select(e => e.Name)));Content trimmed. See full issue
#209 Shortcut for mapping subtypes
instead of writing:
.ForMember(dto => dto.Contact, opt => opt.MapFrom(src => Mapper.Map<SOHeader, SalesOrderContact>(src)))
it would be nice to write something like
.ForMember(dto => dto.Contact, opt => opt.UsingMap<SOHeader, SalesOrderContact>() )
Improvements
#489 Support for WP8.1
Hi Jimmy!
Is it possible for you to add support for WP8.1/Universal Apps?
#482 Mapper.AssertConfigurationIsValid()
I like to have one unit test for each profile I've defined, so I use the overload of Mapper.AssertConfigurationIsValid() that takes a profile name. However, I'd rather have a type-safe reference to the profile than a string, since if I happen to have misspelled the profile name in the test, my test will always pass.
I would therefore suggest the addition of the following method to the Mapper class:
public static void AssertConfigurationIsValid<TProfile>()
where TProfile : Profile, new()
{
AssertConfigurationIsValid(new TProfile().ProfileName);
}
As far as I can tell that's all it would take.
Content trimmed. See full issue
#480 Issue #473. Static DynamicMap and CreateMap APIs should be thread-safe
It's variant of changes. Mostly idea, because of strong types are used and not all platforms were tested.
#473 Static DynamicMap and CreateMap APIs should be thread-safe
I know, there have been closed bug reports in the past (#208, #50), but we just stumbled into the same trap. Since AutoMapper's primary API is static and AutoMapper is meant to be used in complex applications, we automatically assumed that it must be thread-safe.
Instead, it is not - calling DynamicMap and CreateMap on different threads can lead to (and, in our case, has lead to) multithreading issues. As static APIs are bound to be called from different threads, I want to again raise this request for thread-safe static APIs.
(Indeed, the static DynamicMap API is useless as long as not thread-safe, isn't it? In what context could you ever use it in an application?)
#468 Update QueryableExtensions.cs
Handles null source property so it will not create an object with possible non-nullable properties which would result in an exception.
#466 Set ResolutionContext.DestinationValue when it is resolved
When a value is resolved, set it on ResolutionContext.DestinationValue so that subsequent mappers in the resolution chain can make use of the resolved value.
This is in regards to my efforts to use AutoMapper to map from a DTO to a domain model that uses DDD, see https://groups.google.com/forum/#!topic/automapper-users/_xm0A-mA03U.
#465 Linq expression builder doesn't support max depth
There is a MaxDepth configuration option for CreateMap, but seems the linq expression doesn't respect that. So if I have circular references of an entity and its property, .Project() would result in stackoverflow.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using System.Data.Entity;
_Content trimmed. See [full issue](ht...
3.1.1
3.1.0
AutoMapper expands its Portable Class Library support to include Xamarin. AutoMapper 3.1 supports the following runtimes:
- .NET 4 and higher
- Silverlight 5
- Windows Phone 8
- .NET for Windows Store apps (WinRT)
- Xamarin.iOS
- Xamarin.Android
Full list of closed issues
Full list of changes
Enhancements
- Sharing base type mappings between derived types #309
- Added possibility to disable constructor mapping for a profile #401
- Extremely slow with large arrays #390
- Revamped API for custom object mappers #385
- Support array types in LINQ queries #375
- AutoMapper now signed (again) #373
- Support for MonoTouch #372
- Support for MonoDroid #371
- Supporting custom expressions for child members in LINQ queries #366
- Automatic support of Enumerable/Queryable extension methods (Count() etc) #365
- Complete support for inheriting parent mappings, for multiple children #348, #339, #329, #315, #307
- Add Items bag to CreateMap and Map options #322
- Supporting child containers for MappingEngine instance #320
Bug Fixes
3.0.0
AutoMapper is now a Portable Class Library (PCL) to target multiple platforms including:
- .NET 4 and higher
- Silverlight 4 and higher
- Windows Phone 7.5 and higher
- .NET for Windows Store apps (WinRT)
Quite a bit of under-the-covers refactoring was needed to convert to a PCL, which should make it easier to have cross-platform support going forward.
New features:
- Cross platform support
- Code comments for public API
- Collection, MapFrom and flattening support in LINQ projection
Issues closed:
- Automapper: complex nested collections mapping with Entity Framework #360
- AutoMapper uses Expression.Invoke when Entity Framework does not support it. #358
- FileNotFoundException in PCL on WinRT App #353
- Different destination instance using Mapper.Map<TSource, TDestination> with CreateMissingTypeMaps option #352
- AutoMapper QueryableExtensions throws NullReference #351
- MappingEngine.CreateMapExpression #347
- Release notes / Change log for project #346 (hardy-har-har)
- Cannot project array type #344
- Entity Framework 5.0 + Project() = Null reference #343
- Edited QueryableExtensions so that it handles OrderBy and ThenBy on child collections. #327
- Fixed projection with null reference or null collection in source object. #310
- CreateMapExpression MapFrom problem #299