Skip to content

Instantly share code, notes, and snippets.

View lbargaoanu's full-sized avatar

Lucian Bargaoanu lbargaoanu

View GitHub Profile
(src, dest, ctxt) =>
{
return (src == null)
? null
: {
var typeMapDestination = dest ?? new DeepTypeMapper.CustomerDTO();
try
{
var resolvedValue = ((false | (src == null)) | (src.Address == null)) ? null : src.Address.City;
typeMapDestination.AddressCity = resolvedValue;
(src, dest, ctxt) =>
{
return (src == null)
? null
: {
var typeMapDestination = dest ?? new ComplexTypeMapper.Foo();
try
{
var resolvedValue = (false | (src == null)) ? null : src.Ints;
typeMapDestination.Ints = (resolvedValue == null)
.Lambda #Lambda1<System.Func`4[System.Collections.Generic.List`1[Benchmarks.Models.Test],System.Collections.Generic.List`1[Benchmarks.ViewModels.TestViewModel],AutoMapper.ResolutionContext,System.Collections.Generic.List`1[Benchmarks.ViewModels.TestViewModel]]>(
System.Collections.Generic.List`1[Benchmarks.Models.Test] $source,
System.Collections.Generic.List`1[Benchmarks.ViewModels.TestViewModel] $destination,
AutoMapper.ResolutionContext $context) {
.Try {
.If ($source == null) {
.If ($destination != null) {
$destination
} .Else {
.New System.Collections.Generic.List`1[Benchmarks.ViewModels.TestViewModel]()
void Main()
{
var _mapperConfiguration = new MapperConfiguration(cfg => {
cfg.CreateMap(typeof(NodeDto<>), typeof(NodeModel<>));
cfg.CreateMap(typeof(NodeDto<>), typeof(INodeModel<>));
cfg.CreateMap(typeof(INodeModel<>), typeof(NodeModel<>));
});
var dto = new NodeDto<int> { ID = 13, Name = "Hi" };
using ...
static void Main(string[] args)
{
var x = (Microsoft.Office.Interop.Excel._Application) Marshal.GetActiveObject("Excel.Application");
x.ChartDataPointTrack = false;
MapperRegistry.Mappers.Add(new ComObjectMapper());
var config = new MapperConfiguration(c => c.CreateMap<Microsoft.Office.Interop.Excel._Application, App>());
config.AssertConfigurationIsValid();
var mapper = config.CreateMapper();
POST https://visualstudiogallery.msdn.microsoft.com/Services/VStudio/Extension.svc HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
Host: visualstudiogallery.msdn.microsoft.com
Content-Length: 1751
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Close
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://tempuri.org/IVsIdeService/GetCurrentVersionsForVsixList</a:Action><a:MessageID>urn:uuid:db21cde5-8186-484b-9215-46588815aac2</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand="1">https://visualstudiogallery.msdn.microsoft.com/Services/VStudio/Extension.svc</a:To></s:Header><s:Body><GetCurrentVersionsForVsixList xmlns="http://tempuri.org/"><vsixIds xmlns:b="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><b:string>2d5de770-50e9-4dcf-87e9-ea1ed1
public static void Main()
{
var config = new MapperConfiguration(c =>
{
c.CreateMap<Model, Dto>().ForMember(d=>d.Country, o=>o.ResolveUsing<ResolveEntityFromId<Country>, long?>(s => 0));
});
config.AssertConfigurationIsValid();
var mapper = config.CreateMapper();
var source = new Model { FooId = Guid.NewGuid(), ShortDescription = "Yoyodyne Foo", FullDescription = "Deluxe Foo Manufactured by Yoyodyne, Inc.", Date = DateTime.Now.ToUniversalTime()};
.Lambda #Lambda1<System.Func`4[AutoMapper.UnitTests.CustomMapping.When_custom_mapping_with_different_types+Source,AutoMapper.UnitTests.CustomMapping.When_custom_mapping_with_different_types+Destination,AutoMapper.ResolutionContext,AutoMapper.UnitTests.CustomMapping.When_custom_mapping_with_different_types+Destination]>(
AutoMapper.UnitTests.CustomMapping.When_custom_mapping_with_different_types+Source $src,
AutoMapper.UnitTests.CustomMapping.When_custom_mapping_with_different_types+Destination $dest,
AutoMapper.ResolutionContext $ctxt) {
.If ($src == .Default(AutoMapper.UnitTests.CustomMapping.When_custom_mapping_with_different_types+Source)) {
.Default(AutoMapper.UnitTests.CustomMapping.When_custom_mapping_with_different_types+Destination)
} .Else {
.Block() {
$ctxt.TypeMap = .Constant<AutoMapper.TypeMap>(AutoMapper.TypeMap);
$dest = ($dest ?? .New AutoMapper.UnitTests.CustomMapping.When_custom_mapping_with_different_types+Destination());
namespace Source
{
public class Instance
{
public Type Type { get; set; }
public object Definition { get; set; }
}
public sealed class Class : Instance
{
at AgileObjects.ReadableExpressions.ExpressionTranslatorRegistry.Translate(Expression expression, TranslationContext context)
at AgileObjects.ReadableExpressions.Translators.ExpressionTranslatorBase.GetTranslation(Expression expression, TranslationContext context)
at AgileObjects.ReadableExpressions.Translators.UnaryExpressionTranslator.Translate(Expression expression, TranslationContext context)
at AgileObjects.ReadableExpressions.ExpressionTranslatorRegistry.Translate(Expression expression, TranslationContext context)
at AgileObjects.ReadableExpressions.Translators.ExpressionTranslatorBase.GetTranslation(Expression expression, TranslationContext context)
at AgileObjects.ReadableExpressions.Translators.BlockExpressionTranslator.GetTerminatedStatementOrNull(Expression expression, TranslationContext context)
at AgileObjects.ReadableExpressions.Translators.BlockExpressionTranslator.<>c__DisplayClass3_0.<GetBlockLines>b__1(Expression exp)
at System.Linq.Enumerable.WhereSelectEnumerableIte