locked
Check GUID is null? RRS feed

  • Question

  • User-1104215994 posted

    Hi,

    I wonder if there is a way to check GUID is null. <g class="gr_ gr_75 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="75" data-gr-id="75">ReferenceId</g> is GUID.

     var result= await _unitOfWork.GameBankRepository.GetGamesAsync(g =>
                            g.productCode == requestDto.productCode && g.referenceId == null);

    Thank you in advance.

    Wednesday, July 24, 2019 2:17 PM

Answers

  • User753101303 posted

    Hi,

    referenceId is a Guid or a Guid? (in C# the ? suffix is for nullable types)

    If it is "empty" rather than null, try g.referenceId == Guid.Empty

    (or if you have an error message tell what it is so that we don't have to guess first which problem you see).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 24, 2019 2:28 PM

All replies

  • User753101303 posted

    Hi,

    referenceId is a Guid or a Guid? (in C# the ? suffix is for nullable types)

    If it is "empty" rather than null, try g.referenceId == Guid.Empty

    (or if you have an error message tell what it is so that we don't have to guess first which problem you see).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 24, 2019 2:28 PM
  • User-1104215994 posted

    It is <g class="gr_ gr_50 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="50" data-gr-id="50"><g class="gr_ gr_51 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins replaceWithoutSep" id="51" data-gr-id="51">Guid</g></g>. I will try <g class="gr_ gr_66 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="66" data-gr-id="66">Guid</g><g class="gr_ gr_71 gr-alert gr_gramm gr_inline_cards gr_run_anim Style replaceWithoutSep" id="71" data-gr-id="71">.Empty</g> to check 00000000-0000-0000-0000-000000000000

    Thank you <g class="gr_ gr_103 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="103" data-gr-id="103">PatriceSc</g>.

    Wednesday, July 24, 2019 2:32 PM