2

I have isolated the problem to the following lines of code in the BOM method that calls the stored procedure:

        if ((includeAgeSeventeenAndUnder == CodeFluentPersistence.DefaultBooleanValue))
        {
            return null;
        }
        if ((includeAgeEighteenAndOver == CodeFluentPersistence.DefaultBooleanValue))
        {
            return null;
        }

Because CodeFluentPersistence.DefaultBooleanValue equals False. Anytime a parameter of false is passed to the method, the method exits and returns null. How can I prevent this?

Dave
  • 649
  • 5
  • 13
  • what are includeAgeSeventeenAndUnder and includeAgeEighteenAndOver set to? – Will Evers Dec 03 '15 at 20:03
  • 1
    You can add `cfom:checkDefaultValue="false"` at parameter level to remove the check in the BOM. – meziantou Dec 03 '15 at 23:03
  • @meziantou - Your approach is best. I added it to my answer. – Dave Dec 08 '15 at 21:10
  • @Will Evers - I work for a non-profit and the method is used for a report that is required for one of our grants. Most of the data in the report needs to be broken down by age. When I need to get data for a section of the report for 17 and under, I set includeAgeSeventeenAndUnder to true and includeAgeEighteenAndOver to false. When I need data for 18 and over I do the reverse. – Dave Dec 08 '15 at 21:47

1 Answers1

2

I got it working by setting the modeNullable to 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 suggestion is actually preferable since I really don't want the parameters to be nullable. The below snippet demonstrates the correct way to disable the default value check.

<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>
Dave
  • 649
  • 5
  • 13