none
Querying a VarBinary field RRS feed

  • Question

  • I have a field in the database that is of the type varbinary which is used to store encrypted information for sensitive data like SSN. I need to provide search functionality for this column. To do this I am using the below query:

     

    var query = (from cust in _session.Query<CustomerDTO>()
                 where (
                      (cust.CustomerIdentityDTOs.Any(
                       ct =>
                       ct.IdentificationIdHashed.Equals(criteria.TaxIdHashed) ))
                        &&
                      (customerType == "A" || cust.OrganizationOrIndividual == customerType)
                       
                    )
                 select cust).Distinct();
    


    The IdentificationIdHashed and TaxIdHashed are of the type byte[] to hold the encrypted/hashed data. On executing this query I get the error "Boolean Equals(System.Object)".

     

    If I change the comparision to

    ct.IdentificationIdHashed.SequenceEqual(criteria.TaxIdHashed) ))

     

    I get the error

    [SearchCustomer error] Boolean SequenceEqual[Byte](System.Collections.Generic.IEnumerable`1[System.Byte], System.Collections.Generic.IEnumerable`1[System.Byte])

     

    How can I do this comparision?

     

    Sandeep

    Friday, June 10, 2011 4:48 PM

Answers

  • Hi Sandeep,

    Welcome!

    According to your description, Linq to SQL's provider couldn't recongnise this method, you can try to add .ToList() after  _session.Query<CustomerDTO>().

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, June 13, 2011 3:04 AM
    Moderator

All replies

  • Hi Sandeep,

    Welcome!

    According to your description, Linq to SQL's provider couldn't recongnise this method, you can try to add .ToList() after  _session.Query<CustomerDTO>().

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, June 13, 2011 3:04 AM
    Moderator
  • Hi Sandeep,

    I am writing to check the status of the issue on your side. Would you mind letting us know the result of the suggestions?

    If you need further assistance, please feel free to let me know. I will be more than happy to be of assistance.

    Have a nice day


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, June 17, 2011 3:38 AM
    Moderator
  • I am sorry for not replying, I usually get email notifications when someone responds to my posts which did not happen this time around. I will try this out and let you know the results.

     

    Sandeep

    Friday, June 17, 2011 3:54 PM
  • Hi nebushin,

    I am writing to check the status of the issue on your side. Would you mind letting us know the result of the suggestions?

    If you need further assistance, please feel free to let me know. I will be more than happy to be of assistance.

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, June 22, 2011 3:31 AM
    Moderator