TinyMapper: calls TinyMapper.Bind <TTarget, TSource> (); cause performance issues? Should it be called only once?

I have an assembly that contains a class that maps objects from my Dal objects to Business objects. This class displays several different objects (Profile, Address, etc.). I am replacing a TinyMapper card. Generally:

1. List display method

public IEnumerable<TTarget> MapFromDal(IEnumerable<TSource> source){
    return source.Select(MapSingleFromDal);
}

Single Object Matching Method

public TTarget MapSingleFromDal(TSource source){
    //By hand mapping code.
}

When replacing the mapping code with TinyMapper, where should I put my Bind statement? Is it often worth calling often? My first cut in this, I just put this line in my MapSingleFromDal method:

TinyMapper.Bind<TTarget, TSource>();

. , , . ? , ?

TinyMapper.Bind<T1,S1>(); 
TinyMapper.Bind<T2,S2>(); 
TinyMapper.Bind<T3,S3>(); 

, TinyMapper.Bind<T1,S1>();? ?

+4
1

TinyMapper.Bind<TTarget, TSource>() , .. , IL- , , . , , .

TinyMapper.Bind . - .

: Target Source , .. . TinyMapper.Bind<TTarget, TSource>(), Bind Map. Map Bind .

+4

Source: https://habr.com/ru/post/1614368/


All Articles