[Solved] occurred using the connection to database ‘ESCRestaurantDB’ on server ‘.\SQLEXPRESS’ [closed]

Now I haven’t computer with development enviroment with me to test, but I thing you forgot put return statment in opt lambda funtion: CreateMap<Item, ItemToReturnDto>() .ForMember(dest => dest.ItemImages, opt => {return opt.MapFrom(src => src.ItemImages); } If you could paste some more code of how you is call map funtion, we could help you. 4 solved … Read more

[Solved] Automapper custom object

First: You should really read the FAQs on how to post a question and what information should be added. (No, I’m not the downvoter) Here is an example how to get your mapping to work. Please note, that I’ve changed your classes a bit, because AutoMapper needs properties. Source source = new Source(); source.Id = … Read more

[Solved] Generic class of one type to another type in auto mapper

For Mapper.Map<PagedList<CasteModel>>(result);, you need to initialize Mapper like below in Startup.cs public void ConfigureServices(IServiceCollection services) { Mapper.Initialize(cfg => { cfg.AddProfile<AppProfile>(); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); } But, it it recommended to use Dependence Injection to resolve Mapper. Install Package AutoMapper.Extensions.Microsoft.DependencyInjection Startup.cs public void ConfigureServices(IServiceCollection services) { services.AddAutoMapper(typeof(Startup)); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); } UseCase public class ValuesController : ControllerBase { private readonly … Read more