Beispiel #1
0
 /// <summary>
 /// Initialize a new instance of <see cref="MapperBuilder{TSource, TDestiny}"/>
 /// </summary>
 /// <param name="parent">The parent of this mapper</param>
 /// <param name="service">The <see cref="IServiceCollection"/> to register type. </param>
 /// <param name="hashCodeFactoryGenerator">The <see cref="HashCodeFactoryGenerator"/> is used to create GenHashCode.</param>
 public MapperBuilder(IMapperBuilder parent, IServiceCollection service, HashCodeFactoryGenerator hashCodeFactoryGenerator)
 {
     _parent = parent ?? throw new ArgumentNullException(nameof(parent));
     _service = service ?? throw new ArgumentNullException(nameof(service));
     _hashCodeFactoryGenerator = hashCodeFactoryGenerator;
     _generator = new MapperGenerator(typeof(TSource), typeof(TDestiny), _rules, hashCodeFactoryGenerator);
 }
Beispiel #2
0
 private ExpressionBuilder(IMapperBuilder mapperBuilder, BuilderData data)
 {
     _mapperBuilder          = mapperBuilder;
     _data                   = data;
     _fromType               = mapperBuilder.FromType;
     _toType                 = mapperBuilder.ToType;
     _processCrossReferences = true;
 }
Beispiel #3
0
 private static IMapperBuilder GetBuilder <TFrom, TTo>(IMapperBuilder builder) =>
 new MapperBuilder <TFrom, TTo>
 {
     MappingSchema          = builder.MappingSchema,
     MemberMappers          = builder.MemberMappers,
     FromMappingDictionary  = builder.FromMappingDictionary,
     ToMappingDictionary    = builder.ToMappingDictionary,
     MemberFilter           = builder.MemberFilter,
     ProcessCrossReferences = builder.ProcessCrossReferences,
     DeepCopy = builder.DeepCopy
 };
Beispiel #4
0
 public ExpressionBuilder(IMapperBuilder mapperBuilder, ValueTuple <MemberInfo[], LambdaExpression>[] memberMappers)
     : this(mapperBuilder, new BuilderData(memberMappers))
 {
     _processCrossReferences = mapperBuilder.ProcessCrossReferences == true;
 }
Beispiel #5
0
 public static IMapperBuilder Ignore <T>(this IMapperBuilder builder, Expression <Func <T, object> > field)
 {
     return(builder.Ignore(typeof(T), MapPath.Parse(field)));
 }
Beispiel #6
0
 IMapperBuilder IMapperBuilder.AddMapper(IMapperBuilder mapperBuilder)
 {
     _parent.AddMapper(mapperBuilder);
     return this;
 }