locked
Outer Join always executes RRS feed

  • Question

  • I have a table Something with a column Id. Column Id is set as the primary key. I have a second table called SomethingForeign with a single column called SomethingId. SomethingId is also a primary key. A foreign key contraint is set up between Something.Id and SomethingForeign.SomethingId. I am using ADO.NET Data Service (v1).

    If I use http://localhost:2516/Service.svc/Something and view the query through SQL Server Profiler, the query is a simple select as I would expect.

    But if I set up a service operation like
            [WebGet]
            public IQueryable<Something> GetSomethings()
            {
                return this.CurrentDataSource.Somethings;
            }
    

    then the query in SQL Server Profiler has a Left Outer Join with the SomethingForeign table.

    Why is this outer join happening? How can I stop it? It is hurting performance of my data retrieval.

    Thanks!
    Tuesday, March 16, 2010 12:11 AM

Answers

  • Turns out this due to the Entity Framework and how it pulls data.

    Thanks anyway.
    Wednesday, March 17, 2010 9:52 AM

All replies

  • Hi,

    What data provider for WCF Data Services are you using? Is it Entity Framework, LINQ to SQL or something else?
    How do you issue a query to the GetSomethings service operation?

    Thanks,
    Vitek Karas [MSFT]
    Tuesday, March 16, 2010 9:49 AM
    Moderator
  • I am using Entity Framework. I am calling the service operation by entering the URL in IE. (i.e. http://localhost:2516/Service.svc/GetSomethings())

    Tuesday, March 16, 2010 2:11 PM
  • Turns out this due to the Entity Framework and how it pulls data.

    Thanks anyway.
    Wednesday, March 17, 2010 9:52 AM