abp icon indicating copy to clipboard operation
abp copied to clipboard

In a hierarchical project, when a service is defined in the application service layer and the service method uses Dictionary < string, object >, the call parameter is wrong

Open AloneInfinity opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

In a hierarchical project (MVC), the service is defined at the ApplicationService layer, using Dictionary < string, object > as the parameter type, and at the Web layer, when the service is invoked using the Http handler of the Razor view, the service parameter is abnormal.

Reproduction Steps

ApplicationService Layer: Defined service: IDeviceAppService.cs public Task<PagedResultDto<DeviceDto>> GetDeviceListAsync(Dictionary<string, string> parameters);

Web Layer(Using MVC): Defined razor page: List.cshtml In the List.cshtml.cs defined: public async Task<IActionResult> OnGetDeviceList([FromQuery]Dictionary<string, string> parameters) { return new JsonResult(await _deviceAppService.GetDeviceListAsync(parameters)); }

Expected behavior

In the Razor page, when calling the GetDeviceListAsync method of DeviceAppService, pass in the parameter new Dictionary < string, string > { { "Id"," test-01 "}}, the content of the parameter in GetDeviceListAsync of DeviceAppService should be: new Dictionary < string, string > { { "Id", "test-01"}}.

Actual behavior

In the Razor page, when calling the GetDeviceListAsync method of DeviceAppService, pass in the parameter new Dictionary < string, object > { { "Id ","test-01 "}}, the content of the parameter in GetDeviceListAsync of DeviceAppService should be: new Dictionary < string, string > { { "0", "[Id, test-01]"}}.

If the argument type is Dictionary < string, object >, you get new Dictionary < string, object > {{"0", null}}

Regression?

No response

Known Workarounds

No response

Version

8.2.0.0

User Interface

MVC

Database Provider

EF Core (Default)

Tiered or separate authentication server

Tiered

Operation System

Windows (Default)

Other information

No response

AloneInfinity avatar Sep 10 '24 06:09 AloneInfinity

hi @AloneInfinity

Please share your test project.

Thanks

maliming avatar Oct 16 '24 07:10 maliming