none
System.Linq.Dynamic and nullabe data types error when using .Equals RRS feed

  • Question

  •  

    One Dynamic Linq query fails, the other does not.

     

    The error message is:

    An unhandled exception of type 'System.Linq.Dynamic.ParseException' occurred in VrumunReportsTest.exe

    Additional information: Methods on type 'Int32?' are not accessible

    FAILS =>

    Clienten = (from C in db.Clients

    join D in db.Decl on C.ClientId equals D.ClientId

    join E in (db.EDs.Where("Id.Equals(22362086)")) on D.EDId equals E.EDId

    select C);

     

     

    I changed "Id.Equals(22362086)" into "Id == 22362086"

     

     

    OK =>

    Clienten = (from C in db.Clients

    join D in db.Decl on C.ClientId equals D.ClientId

    join E in (db.EDs.Where("Id == 22362086")) on D.EDId equals E.EDId

    select C);

     

    I'm using System.Linq.Dynamic from Microsoft.

    It looks as if there is an error in the expression parser?

    Is there a difference between .Equals and ==

    Wednesday, June 4, 2008 9:25 PM

Answers

  • Found the answer myself.

     

    I added the "Value" property to the Id.

    Id is al nullable type, and this works fine.

     

    Clienten = (from C in db.Clients

    join D in db.Decl on C.ClientId equals D.ClientId

    join E in (db.EDs.Where("Id.Value.Equals(22362086)")) on D.EDId equals E.EDId

    select C);

    Wednesday, June 4, 2008 10:21 PM

All replies

  • Found the answer myself.

     

    I added the "Value" property to the Id.

    Id is al nullable type, and this works fine.

     

    Clienten = (from C in db.Clients

    join D in db.Decl on C.ClientId equals D.ClientId

    join E in (db.EDs.Where("Id.Value.Equals(22362086)")) on D.EDId equals E.EDId

    select C);

    Wednesday, June 4, 2008 10:21 PM
  • Buddy my Byddy you save one week of work to develop a framework using dynamic link, i was prepared do kick off all work and i was inveigh very very much the dynamic Linq, i was thinking to change my Carreer, Very Very Very Thanks!!!!!
    Saturday, September 4, 2010 4:04 AM