question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mapping must be called using ServiceAdapter

See original GitHub issue

I get the same error after calling the scan method in code. here is my Code

       ```
        var Config = GetConfiguration();
        Services.AddSingleton(Config);
        Services.AddScoped<IMapper, ServiceMapper>();
        Config.Scan(assemblies);
more informatino i use autofac for DI in .net core 3.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12

github_iconTop GitHub Comments

6reactions
Calabongacommented, Apr 13, 2022

this approach is not working: config.Map(dest => dest.Name, src => MapContext.Current.GetService<IServive>().Format(src.User.Name))

Exception appears: InvalidOperationException: Mapping must be called using ServiceAdapter

1reaction
sonsy-softcommented, Mar 31, 2020

is it a bug , isn’t it ? we usually need service for complex statement it’s not only in a expression tree is there any solution else ? how can i fix it or add this feature to mapster?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mapping must be called using ServiceAdapter · Issue #224
when I want to use MapContext.Current.GetService() in my mapping I get the error Mapping must be called using ServiceAdapter ? public class ......
Read more >
Using Mapster w/DI where should I be putting my mapping?
Config in the Startup.ConfigureServices method Iget an error "Mapping must be called using ServiceAdapter". Not sure how/where that would be ...
Read more >
Mapster
I'm using ProjectToType to generate mapping expressions for both SQL Server projects and a MongoDB project: ... Mapping must be called using ServiceAdapter....
Read more >
InvalidOperationException when using DI in collection ...
System.InvalidOperationException : Mapping must be called using ServiceAdapter at Mapster.TypeAdapterExtensions.GetService[TService](MapContext ...
Read more >
Creating a Service Adapter using On-Demand Services SDK
Your service adapter must provide the following: The mapping of instance groups to jobs for the deployment. Job level properties for the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found