Stored Procedure Result RRS feed

  • Question

  • I have noticed something strange when using LINQ with a stored procedure mapped to a view, and cannot figure out why LINQ handled these two differently.

    First, my database has two views:

    1. "star_TicketView"
    2. star_IncidentView".

    Both views are very similiar, they are both primarily based upon the corresponding tables:

    1. star_Ticket table.
    2. star_Incident table.

    I also have two nearly identical stored procedures:

    1. star_SearchForTicketsByTitle
    2. star_SearchForIncidentsByTitle

    Both of the stored procedures except the exact same parameters (int productID, string title).

    Using the LINQ designer I dragged the stored procredure from the ServerExplorer to the corresponding views (the star_SearchForTicketsByTitle view was dragged onto the star_TicketView view, and the star_SearchForIncidentsByTitle was dragged onto the star_IncidentView view).

    Both stored procedures work as expected.

    The incosistent behavior I noticed is for the Ticket search, the result creates an object of type:


    which has a partical class created of the same name in the designer.

    The Incident search, the result is an ISingleResult object, and I am curious as to why there is not an object of type:

    star_SearchForIncidentsByTitleResult ?

    Any ideas of what is different? I can post the Script of the views if needed, but the only actual difference between the two views is the TicketView joins to the customer table, but the IncidentView does not.

    Any ideas as to why the IncidentSingleResult class (or return type) was not created?

    Thank you,

    Wednesday, September 2, 2009 5:40 PM


  • I figured it out, I was wrong thinking I had dragged the result for the Ticket onto the TicketView. I noticied if I drag the stored procedure into the Method area of the designer (on the right side of the splitter control) then an object of type <StoredProcedureName>SingleResult is created.

    This is actually what I need because there is a derived field in the stored procedure that when mapped to an object the value is not returned.

    Just thought I would post my own result.

    • Marked as answer by TampaPokerPro Wednesday, September 2, 2009 6:04 PM
    Wednesday, September 2, 2009 6:04 PM