New Posts New Posts RSS Feed: Entity Server Exception creating PredicateDescription with InList operator on nullable db properties
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Entity Server Exception creating PredicateDescription with InList operator on nullable db properties

 Post Reply Post Reply
Author
pk55 View Drop Down
Senior Member
Senior Member


Joined: 22-Jul-2009
Location: CA
Posts: 105
Post Options Post Options   Quote pk55 Quote  Post ReplyReply Direct Link To This Post Topic: Entity Server Exception creating PredicateDescription with InList operator on nullable db properties
    Posted: 30-Jun-2011 at 6:50pm

I get entity server exceptions when I try to build a predicate description (either through PredicateBuilder.Make or just newing up a PredicateDescription) when the property to compare to is nullable in the db (with the exception of nullable stirngs; those always seem to work).   I've tried explicitly casting values to the nullable type (like int?), typing it as an nullable IList, etc. and nothing seems to work.

I'm using the 6.1.2.0c build.  This was from an nullable int property:
 
Exception Type: IdeaBlade.EntityModel.EntityServerException
Message: Invalid values for InList operation - not all values of type: System.Nullable`1[System.Int32]
RemoteExceptionName: System.ArgumentException
RemoteExceptionDetails: System.ArgumentException: Invalid values for InList operation - not all values of type: System.Nullable`1[System.Int32]
   at IdeaBlade.Linq.PredicateDescription.Validate()
   at IdeaBlade.Linq.PredicateDescription.Initialize(FilterOperator filterOp, Object value, Boolean ignoreCase)
   at IdeaBlade.Linq.PredicateDescription..ctor(Type instanceType, String propertyPath, FilterOperator filterOp, Object value, Boolean ignoreCase)
 
You can try it against NorthwindIB Product table.  It has some nullable smallint types:
 
var p = new PredicateDescription(typeof(Product), "UnitsInStock", FilterOperator.InList, new[] {1,2});
 
This works fine against a non-nullable db column and as I said, works on nullable strings.
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 01-Jul-2011 at 6:26pm
Thanks pk55. I've submitted another bug report for this. Just so we're on the same page, I had to modify the code as follows for it to throw the same exception.

var list = new short?[] { 1, 2 };
var p = new PredicateDescription(typeof(Product), Product.EntityPropertyNames.UnitsInStock, FilterOperator.InList, list);
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 11-Jul-2011 at 4:54pm
Hi pk55;

This has just been fixed. The patch I sent you doesn't contain this fix. If you want, you can hold off on downloading that patch and I can send you a new one that includes this.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down