View RemoveUnusedFeatures.cs
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
var configurationExpression = new MapperConfigurationExpression(); | |
configurationExpression.RemoveUnusedFeatures(); | |
configurationExpression.AddProfile<MyMappings>(); | |
var config = new MapperConfiguration(configurationExpression); | |
class MyMappings : Profile | |
{ | |
public MyMappings() | |
{ | |
this.RemoveUnusedFeatures(); | |
} |
View GuiLikeSyncContext.cs
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
using System; | |
using System.Threading; | |
using System.Collections.Concurrent; | |
using System.Diagnostics; | |
namespace UiPath.CoreIpc.Tests | |
{ | |
public class GuiLikeSyncContext : SynchronizationContext | |
{ | |
private readonly BlockingCollection<(SendOrPostCallback Callback, object State)> _workQueue = new BlockingCollection<(SendOrPostCallback, object)>(); |
View ProjectToFlattening.cs
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
static void Main(string[] args) | |
{ | |
Mapper.Initialize(cfg => | |
{ | |
cfg.AddProfile<MyMapperProfile>(); | |
}); | |
Mapper.AssertConfigurationIsValid(); | |
new[]{new OrderDTO{ customer = new customer { ID = 1, name = "john" }}}.AsQueryable().ProjectTo<Order>().Dump(); | |
} | |
public class Order |
View GetMembers.cs
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
void Main() | |
{ | |
Mapper.Initialize(cfg => | |
{ | |
cfg.CreateMap<Source, Destination>().ForMember(dest => dest.ValuesCount, opt => opt.MapFrom(s=>s.Value1+s.Value2)); | |
cfg.CreateMap<SourceItem, DestItem>(); | |
}); | |
Mapper.AssertConfigurationIsValid(); | |
//Mapper.Configuration.BuildExecutionPlan(typeof(Source), typeof(Destination)).ToReadableString().Dump(); | |
var expression = Mapper.Configuration.ResolveTypeMap(typeof(Source), typeof(Destination)).PropertyMaps.Last().CustomMapExpression; |
View DateString.cs
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
public void Main() | |
{ | |
var config = new MapperConfiguration(cfg => { | |
cfg.CreateMissingTypeMaps = false; | |
cfg.CreateMap<DateTimeDetails, PickupDetails>().ForMember(dest => dest.time, opt => opt.MapFrom(src => src)); | |
cfg.CreateMap<DateTime?, DateString>().ConvertUsing(src => new DateString { Value = src.HasValue ? src.Value.ToString("yyyyMMdd") : String.Empty}); | |
cfg.CreateMap<DateTimeDetails, TimeString>() | |
.ForMember(dest => dest.timeZoneOffset, opt => opt.MapFrom(src => src.TimeZoneOffset.ToString())) | |
.ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.Time)); | |
}); |
View Specified.cs
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
void Main() | |
{ | |
Mapper.Initialize(cfg=> | |
{ | |
cfg.CreateMap<object, bool>().ConvertUsing(o=>o!=null); | |
cfg.RecognizeDestinationPostfixes("Specified"); | |
}); | |
Mapper.AssertConfigurationIsValid(); | |
View ReverseMapMemberListNone.cs
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
static void Main(string[] args) | |
{ | |
var config = new MapperConfiguration(cfg => | |
{ | |
cfg.CreateMap<ClassFrom, ClassTo>(MemberList.None).ReverseMap(); | |
}); | |
config.AssertConfigurationIsValid(); | |
config.FindTypeMapFor(typeof(ClassTo), typeof(ClassFrom)).ConfiguredMemberList.Dump(); | |
var mapper = config.CreateMapper(); | |
var fromList = new List<ClassFrom> |
View RecursiveDynamicMaps.cs
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
public static void Main() | |
{ | |
Mapper.Initialize(cfg=> | |
{ | |
}); | |
Mapper.AssertConfigurationIsValid(); | |
var book = new Book | |
{ | |
Name = "B1", |
View DefaultFlattening.cs
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
public static void Main(string[] args) | |
{ | |
Mapper.Initialize(cfg => | |
{ | |
cfg.CreateMap<PartType, Part>(); | |
}); | |
Mapper.AssertConfigurationIsValid(); | |
var result = Mapper.Map<Part>(GetPart()).Dump(); |
View AppSettings.cs
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
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Configuration; | |
using System.Globalization; | |
using System.Text; | |
namespace UiPath.Shared | |
{ | |
public static class AppSettings |
NewerOlder