Mapping must be called using ServiceAdapter
See original GitHub issuewhen I want to use MapContext.Current.GetService<IMyService>() in my mapping I get the error Mapping must be called using ServiceAdapter ?
public class RegisteredCharityConfig : IRegister
{
public void Register(TypeAdapterConfig config)
{
config
.NewConfig<CharityAccount,RegisteredCharityDto>()
.PreserveReference(true)
.AddDestinationTransform((string x) => x.Trim())
.Map(dest => dest.ImageUrl, src => MapContext.Current.GetService<IUrlUtility>().GetUrlDirectoryMinified(DirectoryKind.Charity, src.Id) )
;
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
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 >AutoMapper Madness - Unit Testing Your Maps - Blog
AutoMapper will throw an AutoMapperMappingException with the message that begins with “Missing type map configuration or unsupported mapping.” ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Can
linq.ProjectToType<Dto>(mapper.Config)Hi chaowlert I get the same error after calling the scan method in code. here is my Code
more informatino i use autofac for DI in .net core 3.1