Entity Data Source query syntax is not valid RRS feed

  • Question

  • Is it possible to use conditional (?) or null-coalescing (??) operators in Select and Where properties of an Entity Data Source?

    Here is a simple example:

    <asp:EntityDataSource ID="edsSchool" runat="server" ContextTypeName="MyEntities"
      EnableFlattening="False" EntitySetName="Schools" 
      Select="it.[SchoolID], it.[SchoolName]"
      Where="it.[SchoolName] == (@schoolName ?? it.[SchoolName])">
        <asp:ControlParameter Name="schoolName" Type="String" ControlID="txtSchool" PropertyName="Text" />

    This produces the error The query syntax is not valid. Near term '?'

    If a school name is entered, then I want to select it, if not, I want to select all schools.


    Wednesday, November 16, 2011 4:04 PM


All replies