bahar.alirezaei
bahar.alirezaei

Reputation: 107

How can we use Automapper 10 in Extension Method?

We have used Old version of Automapper in Static Class and Extension method

  public static Account GetAccountDomain(this AccountViewModel viewModel)
    {
        return AutoMapper.Mapper.Map<AccountViewModel, Account>(viewModel);
    }

and we had used this without caring about the technology of mapping in Domain and command Handler and Query Handler as following

  accountViewModel.GetAccountDomain();

what can we do in dot net core and automapper 10 ?

Upvotes: 0

Views: 198

Answers (1)

bahar.alirezaei
bahar.alirezaei

Reputation: 107

Automapper has removed Static state for better performance. It should use with DI Pattern(IMapper) in all of framework that you need.

Upvotes: 1

Related Questions