Cannot create projection while there is an explicit expansion specified on the same query RRS feed

  • Question

  • I get this error when, as it says, when I am tying to do a

    query = from blah in context.Expand("sometype") select new {A= blah.x}

    I need to do an explicit projection because some of the columns contain husge amounts of data which I do not want to be sent acorss the wire.

    I think I need to Expand becuase I need to populate the entities at the end of the forign key relationships.

    Am I stuck? Is WCF Data Services (3.5SP1 latest patch) not up to the job?

    Or is there another solution?



    Friday, September 10, 2010 1:28 PM


All replies

  • Raevean answered my question in this other topic.  http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/thread/279a3882-3425-4c5c-9c65-e88ff41ec9e8

    Apparently there is no need to explicity ask for the expansion since you're including the expansion entitiy in the projection.  Try removing the expansion and see if that works.

    Saturday, September 11, 2010 3:10 PM
  • Hi Matt,


    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!



    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, September 14, 2010 8:56 AM
  • I have not been able to try your solution because of shifting priorities.

    I had tried projection at the time but failed to get it work because I could not get it to cast to the type of collection I (thought I) needed.

    I had implemented a workaround by fetching the data in a separate call and returning it as a separate collection from my method. I know it's not the most efficient and optimal, but it works. For this reason I do not have the time to experiment with doing it the right way just now.

    I may be able to return to it in a few weeks.



    Friday, September 17, 2010 8:05 AM