Created
April 19, 2016 14:50
-
-
Save lbargaoanu/5361c6a041cb7c0c035121d8f9a5a065 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
.Lambda #Lambda1<System.Func`3[System.Object,AutoMapper.ResolutionContext,System.Object]>( | |
System.Object $src, | |
AutoMapper.ResolutionContext $ctxt) { | |
.If ($src == null) { | |
null | |
} .Else { | |
.Block( | |
AutoMapper.Tests.EnumMappingFixture+OrderDtoWithOwnStatus $mapObj, | |
AutoMapper.Tests.EnumMappingFixture+Order $mapFrom) { | |
$mapFrom = (AutoMapper.Tests.EnumMappingFixture+Order)$src; | |
$mapObj = (AutoMapper.Tests.EnumMappingFixture+OrderDtoWithOwnStatus).Block(System.Object $destination) { | |
$destination = .If ((AutoMapper.Tests.EnumMappingFixture+OrderDtoWithOwnStatus)$ctxt.DestinationValue != .Default(AutoMapper.Tests.EnumMappingFixture+OrderDtoWithOwnStatus)) { | |
(AutoMapper.Tests.EnumMappingFixture+OrderDtoWithOwnStatus)$ctxt.DestinationValue | |
} .Else { | |
.New AutoMapper.Tests.EnumMappingFixture+OrderDtoWithOwnStatus() | |
} | |
}; | |
.Call $ctxt.BeforeMap((System.Object)$mapObj); | |
.Try { | |
.Block<System.Void>() { | |
$mapObj.Status = (AutoMapper.Tests.EnumMappingFixture+StatusForDto)((AutoMapper.Tests.EnumMappingFixture+StatusForDto).Call ($ctxt.Mapper).Map( | |
(System.Object).If ($mapFrom == .Default(AutoMapper.Tests.EnumMappingFixture+Order)) { | |
.Default(AutoMapper.Tests.EnumMappingFixture+Status) | |
} .Else { | |
$mapFrom.Status | |
}, | |
(System.Object)$mapObj.Status, | |
.If ((System.Object).If ($mapFrom == .Default(AutoMapper.Tests.EnumMappingFixture+Order)) { | |
.Default(AutoMapper.Tests.EnumMappingFixture+Status) | |
} .Else { | |
$mapFrom.Status | |
} == null) { | |
.Constant<System.Type>(AutoMapper.Tests.EnumMappingFixture+Status) | |
} .Else { | |
.Call (.If ($mapFrom == .Default(AutoMapper.Tests.EnumMappingFixture+Order)) { | |
.Default(AutoMapper.Tests.EnumMappingFixture+Status) | |
} .Else { | |
$mapFrom.Status | |
}).GetType() | |
}, | |
.Constant<System.RuntimeType>(AutoMapper.Tests.EnumMappingFixture+StatusForDto), | |
$ctxt)) | |
} | |
} .Catch (AutoMapper.AutoMapperMappingException $ex) { | |
.Block() { | |
$ex.PropertyMap = .Constant<AutoMapper.PropertyMap>(AutoMapper.PropertyMap); | |
.Rethrow | |
} | |
} .Catch (System.Exception $ex) { | |
.Throw .New AutoMapper.AutoMapperMappingException( | |
$ctxt, | |
$ex, | |
.Constant<AutoMapper.PropertyMap>(AutoMapper.PropertyMap)) | |
}; | |
.Call $ctxt.AfterMap((System.Object)$mapObj); | |
(System.Object)$mapObj | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment