New Posts New Posts RSS Feed: Problems querying associations
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Problems querying associations

 Post Reply Post Reply
Author
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Topic: Problems querying associations
    Posted: 16-Jun-2010 at 10:19am
A property value compatibility check can be triggered as an object graph is materialized during a query.  The property it's complaining about could be on Closing, UserClosing, or even another type accessed via a navigation property on one of these types.  The likely trigger is logic in an entity constructor - so check these; and also if you've overridden any UpdateNullEntity methods in your entities. 
 
If neither of the above looks like the culprit, please send us your EDMX.
Back to Top
jmarbutt View Drop Down
DevForce MVP
DevForce MVP


Joined: 04-Jun-2010
Posts: 17
Post Options Post Options   Quote jmarbutt Quote  Post ReplyReply Direct Link To This Post Posted: 14-Jun-2010 at 7:30am
I have tried the following 2 queries and get the same error:

   var query = from c in Context.Closings
                        where c.UserClosings.FirstOrDefault().UserId == CurrentUser.Id
                        select c;
            
            query.ExecuteAsync(op => op.Results.ForEach(Closings.Add));

            var query2 = from uc in Context.UserClosings
                         where uc.UserId == CurrentUser.Id
                         select uc;
            query2 = query2.Include("Closing");
            var op2 = query2.ExecuteAsync();


--------

The error I get is:

Value is not compatible with property: Id DataType: System.Int32


I have checked my model and my data and they both look good. Any other ideas?


Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down