locked
The type 'System.Linq.IQueryProvider' has no settable properties. RRS feed

  • Question

  • I have an EF model on top of SQL with an ADO.NET Data Service in front of that.

    I'm have a number of objects which I'm creating which have 1..* relationships like this:

    SharedItem 1..N Item
    Person 1..N SharedItem
    Scope 1..N SharedItem

    I am having a devil of a time getting the data into the database from my WPF client using CTP 1.5 library.

    My basic model is:
       1. add up objects to collections
       2. add objects to store via store.AddToXXX(object)
       3. hook up links via store.AddLink(singleton, "collectionproperty", object); (1..N)

    When I do the SaveChanges(BATCH) I get an exception of invalid operation 

    The type 'System.Linq.IQueryProvider' has no settable properties.
       at System.Data.Services.Client.ClientType..ctor(Type type, String typeName, Boolean skipSettableCheck)
       at System.Data.Services.Client.ClientType.Create(Type type, Boolean expectModelType)
       at System.Data.Services.Client.ClientType.Create(Type type)
       at System.Data.Services.Client.DataServiceContext.WriteContentProperties(XmlWriter writer, ClientType type, Object resource, EpmSourcePathSegment currentSegment)
       at System.Data.Services.Client.DataServiceContext.WriteContentProperties(XmlWriter writer, ClientType type, Object resource, EpmSourcePathSegment currentSegment)
       at System.Data.Services.Client.DataServiceContext.WriteContentProperties(XmlWriter writer, ClientType type, Object resource, EpmSourcePathSegment currentSegment)
       at System.Data.Services.Client.DataServiceContext.CreateRequestData(ResourceBox box, Boolean newline)
       at System.Data.Services.Client.DataServiceContext.SaveAsyncResult.CreateChangeData(Int32 index, Boolean newline)
       at System.Data.Services.Client.DataServiceContext.SaveAsyncResult.GenerateBatchRequest(Boolean replaceOnUpdate)
       at System.Data.Services.Client.DataServiceContext.SaveAsyncResult.BatchRequest(Boolean replaceOnUpdate)
       at System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions options)
       at SocialUI.Controls.ShareThisControl.backgroundWorker_DoWork(Object sender, DoWorkEventArgs e) in

    I have tried all sorts of variations and I can't seem to get this dang thing to work.  What's weird is that every once in a while it will actually put data into the database, but I can never get it to do it again.

    'elp!
    Windows Search Dev Lead
    Thursday, May 21, 2009 6:43 AM

Answers

  • Well, I think I figured out what I was doing which caused it conniptions.

    I have an entity called Scope.  There is a well-known id which I know and so instead of doing a round-trip to instantiate it, I actually build it by hand and call dsc.AttachObject(myScope).

    But I'm a little bit trickier then that...I have some domain specific logic which I want this scope object to have, and so my Scope is really derived from it to add the additional stuff.  The parent is a scope object.

    So what I'm really doing is dsc.AttachObject(new MyChildScope(...));
    where MyChildScope's base is instantiated with all of the correct parameters to be a real scope object.

    My hope was that as other objects were instantiated they would be hooked up to the right object...but instead I got this IQueryProvider error.
    If I never call SetLink to the attached object then SaveChanges() works.


    Windows Search Dev Lead
    Thursday, May 21, 2009 9:12 PM

All replies

  • can you show us the code you are using to setup the the changes before you can save changes plz
    Daniel Portella - http://undocnet.blogspot.com - This posting is provided "AS IS" with no warranties, and confers no rights. If this post is answered your question please mark as the answer and if it is helpful do like wise.
    Thursday, May 21, 2009 8:37 AM
  • Because the exception is coming from the client library, could you also provide the client-side proxy classes that are involved in this operation?

    Did you use 'Add Service Reference'/DataSvcUtil.exe to code-gen the client-side proxy classes? Or did you hand write them?

    Also, are you using any 1.5 features that would prevent you from trying this with the V1 library? I'd be interested in seeing if its a new problem specific to the CTP.
    Matt Meehan, ADO.NET Data Services (Astoria)
    Thursday, May 21, 2009 3:47 PM
    Moderator
  • Well, I think I figured out what I was doing which caused it conniptions.

    I have an entity called Scope.  There is a well-known id which I know and so instead of doing a round-trip to instantiate it, I actually build it by hand and call dsc.AttachObject(myScope).

    But I'm a little bit trickier then that...I have some domain specific logic which I want this scope object to have, and so my Scope is really derived from it to add the additional stuff.  The parent is a scope object.

    So what I'm really doing is dsc.AttachObject(new MyChildScope(...));
    where MyChildScope's base is instantiated with all of the correct parameters to be a real scope object.

    My hope was that as other objects were instantiated they would be hooked up to the right object...but instead I got this IQueryProvider error.
    If I never call SetLink to the attached object then SaveChanges() works.


    Windows Search Dev Lead
    Thursday, May 21, 2009 9:12 PM