none
LINQ to SQL: object property not being generated RRS feed

  • Question

  • Hi all,

    I'm trying to use LINQ to SQL to represent result from FREETEXTTABLE, a table-valued search function which returns a column for the search rank and a column for the primary key of the table being searched.

    I have a stored procedure that selects from that function.  I created a new class, MyTypeSearchResult, with two properties, Rank and MyTypeId.  MyType already existed.  I then added a relationship going from MyType to MyTypeSearchResult.  Unfortunately, no object property is being generated for MyTypeSearchResult; I only have MyTypeId and Rank.  I checked the designer.cs file, and it's simply not being generated.

    The only unusual thing I've ever done with this DBML file is follow the instructions at http://stackoverflow.com/questions/927006/linq-to-sql-cant-modify-return-type-of-stored-procedure to change the return type of a stored procedure to MyTypeSearchResult by modifying the XML.

    Any suggestions for getting this to work?

    Regards,

        Don
    Thursday, January 28, 2010 3:35 PM

Answers

  • To simplify the problem, I created a class in a DBML file based on a database table, then I created a second class that is to be used as a return type for a table-valued function and that  not based on a database table.

    So it seems that the solution is to add a primary key to the DBML-generated class, even though there is no such thing as a primary key for a table-valued function.
    • Marked as answer by Don 01001100 Monday, February 22, 2010 3:07 PM
    Monday, February 22, 2010 3:07 PM

All replies

  • To simplify the problem, I created a class in a DBML file based on a database table, then I created a second class that is to be used as a return type for a table-valued function and that  not based on a database table.

    So it seems that the solution is to add a primary key to the DBML-generated class, even though there is no such thing as a primary key for a table-valued function.
    • Marked as answer by Don 01001100 Monday, February 22, 2010 3:07 PM
    Monday, February 22, 2010 3:07 PM
  • To simplify the problem, I created a class in a DBML file based on a database table, then I created a second class that is to be used as a return type for a m4a table-valued function and that  not based on a database table.

    So it seems that the solution is to add a primary key to the DBML-generated class, even though there is no such thing as a primary key for a table-valued function.

    Sorry I'm a beginner. I'm afraid I do not fully understand what you said. Can you give more details? Thanks.
    Saturday, July 10, 2010 5:18 AM