Add Cast.To(..) alternative to ApiMapper
ln.build - build0.waldrennach.l--n.de build job pending Details

master
Harald Wolff 2020-12-07 01:16:24 +01:00
parent b5a18938c0
commit c9eca8626b
2 changed files with 6 additions and 2 deletions

View File

@ -9,6 +9,7 @@ using ln.http.exceptions;
using ln.http.router;
using ln.json;
using ln.json.mapping;
using ln.type;
namespace ln.http.api
{
@ -92,6 +93,9 @@ namespace ln.http.api
{
if (!JSONMapper.DefaultMapper.Deserialize(jsonValue, parameterInfo.ParameterType, out arguments[n]))
throw new BadRequestException();
} else if (Cast.To(value, parameterInfo.ParameterType, out arguments[n]))
{
} else if (value is string text)
{
arguments[n] = TypeDescriptor.GetConverter(parameterInfo.ParameterType).ConvertFromInvariantString(text);

View File

@ -4,7 +4,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.1</Version>
<Version>0.0.2-test</Version>
<Authors>Harald Wolff-Thobaben</Authors>
<Company>l--n.de</Company>
<Description>Framework to create REST like APIs</Description>
@ -13,7 +13,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ln.http" Version="0.2.1-test" />
<PackageReference Include="ln.http" Version="0.2.3-test" />
<PackageReference Include="ln.json" Version="1.0.0" />
<!--ProjectReference Include="..\..\ln.http\ln.http\ln.http.csproj" /-->
</ItemGroup>