no data exception and no documentation warnings in generated code
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
$GENERATED_CS_COMMENT
|
||||
|
||||
\#pragma warning disable 1591
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -27,10 +26,6 @@ namespace ${env['packagename']}.Implementations
|
||||
public class ${operation['func']}InputType
|
||||
{
|
||||
#for $inputType in $operation['paramInputTypes']
|
||||
// $inputType['in']
|
||||
// $inputType['name']
|
||||
// $inputType['required']
|
||||
// $inputType['type']
|
||||
#if $inputType['required']
|
||||
[Required]
|
||||
#end if
|
||||
@ -42,8 +37,6 @@ namespace ${env['packagename']}.Implementations
|
||||
#end if
|
||||
#end for
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public class RegularApiImplementation : RegularApiController
|
||||
{
|
||||
|
||||
@ -54,9 +47,6 @@ namespace ${env['packagename']}.Implementations
|
||||
|
||||
#for $operation in $operations
|
||||
#if $operation['method'] == 'get'
|
||||
/// <summary>
|
||||
/// $operation['description']
|
||||
/// </summary>
|
||||
public override async Task<IActionResult> ${operation['func']}(#slurp
|
||||
#if $operation['bodyInputType']
|
||||
[FromBody]$operation['bodyInputType']['csName'] $operation['bodyInputType']['apiName'] #slurp
|
||||
@ -88,63 +78,41 @@ $inputType['type'] $inputType['name']#slurp
|
||||
#end for
|
||||
#end if
|
||||
|
||||
List<$operation['resultType']['csName']> res = await _dbService.ReadBySelect<#slurp
|
||||
#if $operation['bodyInputType']
|
||||
try {
|
||||
List<$operation['resultType']['csName']> res = await _dbService.ReadBySelect<#slurp
|
||||
#if $operation['bodyInputType']
|
||||
$operation['bodyInputType']['csName'], #slurp
|
||||
#elif $operation['paramInputTypes']
|
||||
#elif $operation['paramInputTypes']
|
||||
${operation['func']}InputType, #slurp
|
||||
#else
|
||||
#else
|
||||
Object, #slurp
|
||||
#end if
|
||||
$operation['resultType']['csName']>("#slurp
|
||||
#if not $operation['statement']
|
||||
#if not $operation['statement']
|
||||
SELECT #slurp
|
||||
#set $sep = ""
|
||||
#for $property in $types[$operation['resultType']['apiName']]['properties']
|
||||
#set $sep = ""
|
||||
#for $property in $types[$operation['resultType']['apiName']]['properties']
|
||||
$sep$property['sqlName'] #slurp
|
||||
#set $sep = ","
|
||||
#end for
|
||||
#set $sep = ","
|
||||
#end for
|
||||
FROM $types[$operation['resultType']['apiName']]['sqlName']#slurp
|
||||
#else
|
||||
#else
|
||||
$operation['statement']#slurp
|
||||
#end if
|
||||
#end if
|
||||
", #slurp
|
||||
#if $operation['bodyInputType']
|
||||
#if $operation['bodyInputType']
|
||||
$operation['bodyInputType']['apiName']#slurp
|
||||
#elif $operation['paramInputTypes']
|
||||
#elif $operation['paramInputTypes']
|
||||
paramInput#slurp
|
||||
#else
|
||||
#else
|
||||
null#slurp
|
||||
#end if
|
||||
#end if
|
||||
);
|
||||
return new ObjectResult(res);
|
||||
} catch (NotDataFoundException) {
|
||||
return StatusCode(404, "No $operation['resultType']['apiName'] element found");
|
||||
}
|
||||
|
||||
// Statement:
|
||||
#if not $operation['statement']
|
||||
// SELECT
|
||||
#set $sep = ""
|
||||
#for $property in $types[$operation['resultType']['apiName']]['properties']
|
||||
// $sep$property['sqlName']
|
||||
#set $sep = ","
|
||||
#end for
|
||||
// FROM $types[$operation['resultType']['apiName']]['sqlName'];
|
||||
#else
|
||||
// $operation['statement']
|
||||
#end if
|
||||
#if $operation['bodyInputType']
|
||||
// Input type mapping: $operation['bodyInputType']['apiName'] -> $operation['bodyInputType']['csName']
|
||||
#for $property in $types[$operation['bodyInputType']['apiName']]['properties']
|
||||
// $property['sqlName'] -> $property['csName']
|
||||
#end for
|
||||
#end if
|
||||
// Model object to use: $operation['resultType']['apiName'] -> $operation['resultType']['csName']
|
||||
// Properties to map result:
|
||||
#for $property in $types[$operation['resultType']['apiName']]['properties']
|
||||
// $property['sqlName'] -> $property['csName']
|
||||
#end for
|
||||
#if $operation['isList']
|
||||
// result must be mapped in list
|
||||
#end if
|
||||
return new ObjectResult(res);
|
||||
}
|
||||
|
||||
#elif $operation['method'] == 'post'
|
||||
@ -164,4 +132,3 @@ null#slurp
|
||||
|
||||
}
|
||||
}
|
||||
\#pragma warning restore 1591
|
||||
|
Reference in New Issue
Block a user