1

I have a RAW method for an entity that has GUIDS as parameters.

LOADONE (Guid CwObjectGuid, Guid CountryGuid) RAW

With the corresponding body:

SELECT * FROM dbo.Bid
WHERE Bid_CwObject_Guid = @CwObjectGuid 
AND ((Bid_CountryGuid = @CountryGuid) OR (@CountryGuid = '00000000-0000-0000-0000-000000000000' AND Bid_CountryGuid IS NULL))

The parameter CountryGuid can be a default Guid. However, the method that is generated checks whether the parameter is a default. In that case the method will return NULL.

        if ((countryGuid.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
        {
            return null;
        }

I don't want that check. Can I somehow prevent it?

meziantou
  • 20,589
  • 7
  • 64
  • 83
Peter de Bruijn
  • 792
  • 6
  • 22

1 Answers1

0

By default, the property is not nullable, so CodeFluent check if the value is equals to the default value (see Simon's answer). You can disable this behavior by setting usePersistenceDefaultValue to false:

<cf:method name="load" body="LOADONE(...) RAW" rawBody="...">
  <cf:parameter name="countryGuid" usePersistenceDefaultValue="false"/>
</cf:method>

You can also send nullable guid to the database

<cf:method name="load" body="LOADONE(Guid? id) RAW" rawBody="..." />
meziantou
  • 20,589
  • 7
  • 64
  • 83