Base solution for your next web application
Open Closed

Where can I configure automapper #2857


User avatar
0
ruffzy created

When I map one of my object to the dto I get a stackoverflow exception. This is because I am using a self referencing object. Fortunately automapper allows setting a configuration in startup.cs to prevent that behaviour.

//MVC
            services.AddMvc(options =>
            {
                options.Filters.Add(new CorsAuthorizationFilterFactory(DefaultCorsPolicyName));
            }).AddJsonOptions(opt =>
            {
                opt.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Serialize;
            });

But as I still get the stackoverflow exception after setting the option I guess that in ABP I have to configure that somewhere else. Where?


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can do it in CustomDtoMapper class.

    Thanks.