我通过将 modeNullable 设置为 true 来使其工作。
<cf:method name="Load">
<cf:body text="LOADONE(date startDate, date endDate, bool includeAgeSeventeenAndUnder, bool includeAgeEighteenAndOver,int sisProgramId) RAW " rawText="This has been deleted because it is not relevent to question" language="tsql" />
<cf:parameter typeName="bool" name="includeAgeSeventeenAndUnder" modelNullable="True" />
<cf:parameter typeName="bool" name="includeAgeEighteenAndOver" modelNullable="True" />
</cf:method>
Meziantou 建议实际上更可取,因为我真的不希望参数可以为空。下面的代码片段演示了禁用默认值检查的正确方法。
<cf:method name="Load">
<cf:body text="LOADONE(date startDate, date endDate, bool includeAgeSeventeenAndUnder, bool includeAgeEighteenAndOver,int sisProgramId) RAW " rawText="This has been deleted because it is not relevent to question" language="tsql" />
<cf:parameter typeName="bool" cfom:checkDefaultValue="false" name="includeAgeSeventeenAndUnder" modelNullable="False" />
<cf:parameter typeName="bool" cfom:checkDefaultValue="false" name="includeAgeEighteenAndOver" modelNullable="False" />
</cf:method>