none
Nullable parameters in Linq-to-Sql RRS feed

  • Question

  • I have a stored procedure that has a nullable string parameter. In the Visual Studio linq-to-sql designer, when I drag this stored procedure into the designer, it creates a definition for this sproc, but it does not define the string parameter as nullable which means that I have to enter a value. Does anyone know why this happens and how I can get around it ?

    Monday, July 20, 2009 9:42 AM

Answers

  • The .Net String data type is already nullable since it is a reference type.  The Nullable<T> data type can only be used with value-types.  What's missing is any way to declare a reference type like string as non-nullable.
    Wayward LINQ Lacky
    Monday, July 20, 2009 3:05 PM
    Moderator