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
(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; |
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
$typeMapDestination.Foos = .Block( | |
System.Collections.Generic.List`1[Benchmark.Flattening.ComplexTypeMapper+Foo] $collectionDestination, | |
System.Collections.Generic.List`1[Benchmark.Flattening.ComplexTypeMapper+Foo] $passedDestination) { | |
$passedDestination = .If ($dest == null) { | |
.Default(System.Collections.Generic.List`1[Benchmark.Flattening.ComplexTypeMapper+Foo]) | |
} .Else { | |
$typeMapDestination.Foos | |
}; | |
$collectionDestination = .If ($passedDestination != null) { | |
$passedDestination |
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
public static void Main() | |
{ | |
Mapper.Initialize(a => a.AddProfile<TestProfile>()); | |
var mapSource = new SourceTestModel { SourceDetailTestProperty = 5, SourceBaseTestProperty = 10, UseFirstModel = true }; | |
var expectedResult = new FirstTargetTestModel { DetailTestProperty = 5, BaseTestProperty = 10 }; | |
Mapper.Map<ITestDetail>(mapSource).Dump(); | |
} |
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
#include "stdafx.h" | |
#include <iostream> | |
#include <functional> | |
#include <tuple> | |
#include <utility> | |
#include <vector> | |
class IActiveObject { | |
public: | |
void Post(std::function<void(void)> handler) |
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
static void Main(string[] args) | |
{ | |
MapperConfiguration config = new MapperConfiguration(c => | |
{ | |
c.CreateMap<UserViewModel, ApplicationUsers>().ConvertUsing<UserConvertor>(); | |
}); | |
var mapper = config.CreateMapper(); | |
var user = new UserViewModel | |
{ | |
Email = "[email protected]", |
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
void Main() | |
{ | |
Mapper.Initialize(x => | |
{ | |
x.CreateMap<Origin, OriginContract>(); | |
x.CreateMap<OriginContract, Origin>(); | |
x.CreateMap<State, StateContract>(); | |
x.CreateMap<StateContract, State>(); | |
}); |
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
using static Expression; | |
public static class Extensions | |
{ | |
public static IMappingExpression<TSource, TDestination> Flatten<TSource, TDestination, TSourceMember>( | |
this IMappingExpression<TSource, TDestination> map, | |
Expression<Func<TSource, TSourceMember>> source) | |
{ | |
var innerSourceProperties = | |
from sp in typeof(TSourceMember).GetProperties() |
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
public void Main() | |
{ | |
Mapper.Initialize(cfg => | |
{ | |
cfg.CreateMap<Source, Destination>(); | |
cfg.CreateMap<object, DataRow>().ConvertUsing((s, d)=> | |
{ | |
foreach(var item in Mapper.Map<IDictionary<string, object>>(s)) | |
{ | |
d[item.Key] = item.Value; |
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
using System; | |
using System.Collections; | |
using System.Collections.Specialized; | |
using System.ComponentModel; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Threading; | |
namespace Common | |
{ |
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
namespace Scheduler | |
{ | |
using System; | |
using System.Threading; | |
using System.Diagnostics; | |
using System.Collections.Generic; | |
public static class JobScheduler | |
{ | |
static readonly LinkedList<Job> jobs = new LinkedList<Job>(); |