Back to Devexpress

EntityInstantFeedbackSource.GetQueryable Event

corelibraries-devexpress-dot-data-dot-linq-dot-entityinstantfeedbacksource-b3de24c8.md

latest6.2 KB
Original Source

EntityInstantFeedbackSource.GetQueryable Event

Occurs when the EntityInstantFeedbackSource needs a queryable source, to retrieve objects from the data store.

Namespace : DevExpress.Data.Linq

Assembly : DevExpress.Data.v25.2.dll

NuGet Package : DevExpress.Data

Declaration

csharp
public event EventHandler<GetQueryableEventArgs> GetQueryable
vb
Public Event GetQueryable As EventHandler(Of GetQueryableEventArgs)

Event Data

The GetQueryable event's data class is GetQueryableEventArgs. The following properties provide information specific to this event:

PropertyDescription
AreSourceRowsThreadSafeSpecifies whether elements retrieved by the LinqInstantFeedbackSource‘s queryable source are thread-safe.
KeyExpressionGets or sets the name of the key property.
QueryableSourceGets or sets the queryable data source.
TagGets or sets an arbitrary object associated with a queryable source.

Remarks

Handle this event, to supply a queryable source connected to the required data service. The GetQueryableEventArgs class exposes the GetQueryableEventArgs.Tag property, which you can use to specify an arbitrary object. This object will be passed along with the GetQueryableEventArgs.QueryableSource property to the EntityInstantFeedbackSource.DismissQueryable event handler.

csharp
public partial class Form1 : Form {
    private void Form1_Load(object sender, EventArgs e) {
        efInstantFeedbackSource1.KeyExpression = "EmployeeID";
        efInstantFeedbackSource1.GetQueryable += efInstantFeedbackSource1_GetQueryable;
        efInstantFeedbackSource1.DismissQueryable += efInstantFeedbackSource1_DismissQueryable;
        gridControl1.DataSource = efInstantFeedbackSource1;
    }
    void efInstantFeedbackSource1_GetQueryable(object sender, GetQueryableEventArgs e) {
        NorthwindEntities objectContext = new NorthwindEntities();
        e.QueryableSource = objectContext.Employees;
        e.Tag = objectContext;            
    }
    void efInstantFeedbackSource1_DismissQueryable(object sender, GetQueryableEventArgs e) {
        ((NorthwindEntities)e.Tag).Dispose();         
    }
}
vb
Partial Public Class Form1
    Inherits Form
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        efInstantFeedbackSource1.KeyExpression = "EmployeeID"
        AddHandler efInstantFeedbackSource1.GetQueryable, AddressOf efInstantFeedbackSource1_GetQueryable
        AddHandler efInstantFeedbackSource1.DismissQueryable, AddressOf efInstantFeedbackSource1_DismissQueryable
        gridControl1.DataSource = efInstantFeedbackSource1
    End Sub
    Private Sub efInstantFeedbackSource1_GetQueryable(ByVal sender As Object, ByVal e As GetQueryableEventArgs)
        Dim objectContext As New NorthwindEntities()
        e.QueryableSource = objectContext.Employees
        e.Tag = objectContext
    End Sub
    Private Sub efInstantFeedbackSource1_DismissQueryable(ByVal sender As Object, ByVal e As GetQueryableEventArgs)
        CType(e.Tag, NorthwindEntities).Dispose()
    End Sub
End Class

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetQueryable event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

how-to-bind-wpf-grid-to-data/CS/CodeBehind/EFCore/InstantFeedbackMode/MainWindow.xaml.cs#L15

csharp
};
source.GetQueryable += (sender, e) => {
    var context = new IssuesContext();

wpf-data-grid-implement-crud-operations/CS/CodeBehind/EntityFramework/InstantFeedbackMode/MainWindow.xaml.cs#L18

csharp
};
source.GetQueryable += (sender, e) => {
    var context = new IssuesContext();

how-to-bind-wpf-grid-to-data/VB/CodeBehind/EFCore/InstantFeedbackMode/MainWindow.xaml.vb#L12

vb
}
AddHandler source.GetQueryable, Sub(sender, e)
                                    Dim context = New IssuesContext()

See Also

EntityInstantFeedbackSource Class

EntityInstantFeedbackSource Members

DevExpress.Data.Linq Namespace