Share via


DomainDataSource.QueryName Property

[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]

Gets or sets the name of the query to use for loading.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.DomainServices (in System.Windows.Controls.DomainServices.dll)

Syntax

'Declaration
Public Property QueryName As String
    Get
    Set
'Usage
Dim instance As DomainDataSource
Dim value As String

value = instance.QueryName

instance.QueryName = value
public string QueryName { get; set; }
public:
property String^ QueryName {
    String^ get ();
    void set (String^ value);
}
member QueryName : string with get, set
function get QueryName () : String
function set QueryName (value : String)

Property Value

Type: System.String
The name of the query to use for loading data.

Remarks

The DomainContext will be searched for a method that returns an EntityQuery<TEntity>, with a name that matches the name provided to QueryName. The matched name can be with or without a "Query" suffix.

Examples

The following example shows a DomainDataSource control with the QueryName property set to GetProducts.

<UserControl x:Class="ExampleApplication.MainPage"
    xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="https://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="https://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria"
    xmlns:riaData="clr-namespace:System.Windows.Data;assembly=System.Windows.Controls.Ria"
    xmlns:domain="clr-namespace:SilverlightApplication17.Web"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    mc:Ignorable="d">

    <Grid x:Name="LayoutRoot" Background="White">
        <riaControls:DomainDataSource x:Name="source" QueryName="GetProducts" AutoLoad="true">
            <riaControls:DomainDataSource.DomainContext>
                <domain:ProductDomainContext />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
        <data:DataGrid ItemsSource="{Binding Data, ElementName=source}" />
    </Grid>
</UserControl>

See Also

Reference

DomainDataSource Class

System.Windows.Controls Namespace

Other Resources

DomainDataSource