Back to Devexpress

ODataInstantFeedbackSource.GetSource Event

corelibraries-devexpress-dot-data-dot-odatalinq-dot-odatainstantfeedbacksource.md

latest5.1 KB
Original Source

ODataInstantFeedbackSource.GetSource Event

Occurs when the ODataInstantFeedbackSource needs a queryable source to retrieve objects from the OData service.

Namespace : DevExpress.Data.ODataLinq

Assembly : DevExpress.Data.v25.2.dll

NuGet Package : DevExpress.Data

Declaration

csharp
public event EventHandler<GetSourceEventArgs> GetSource
vb
Public Event GetSource As EventHandler(Of GetSourceEventArgs)

Event Data

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

PropertyDescription
AreSourceRowsThreadSafeSpecifies whether elements retrieved by the ODataInstantFeedbackSource‘s queryable source are thread-safe.
ExtenderThis property is intended for internal use.
KeyExpressionsGets or sets the name of the key property.
Properties
QuerySpecifies the query request to the OData service.
TagGets or sets an arbitrary object associated with a queryable source.

Remarks

Handle this event to supply a queryable source connected to the required OData service. The GetSourceEventArgs class exposes the GetSourceEventArgs.Tag property, which you can use to specify an arbitrary object. This object will be passed along with the GetSourceEventArgs.Query property to the ODataInstantFeedbackSource.DismissSource event handler.

csharp
public partial class Form1 : Form {
    private void Form1_Load(object sender, EventArgs e) {
        oDataInstantFeedbackSource1.KeyExpression = "CustomerID";
        oDataInstantFeedbackSource1.GetQueryable += oDataInstantFeedbackSource1_GetSource;
        gridControl1.DataSource = oDataInstantFeedbackSource1;
    }
    void oDataInstantFeedbackSource1_GetSource(object sender, GetSourceEventArgs e) {
        // DataServiceContext myDataServiceContext = ...
        e.Query = myDataServiceContext.Customers;
    }
}
vb
Partial Public Class Form1
    Inherits Form
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        oDataInstantFeedbackSource1.KeyExpression = "CustomerID"
        AddHandler oDataInstantFeedbackSource1.GetQueryable, AddressOf oDataInstantFeedbackSource1_GetSource
        gridControl1.DataSource = oDataInstantFeedbackSource1
    End Sub
    Private Sub oDataInstantFeedbackSource1_GetSource(ByVal sender As Object, ByVal e As GetSourceEventArgs)
        ' DataServiceContext myDataServiceContext = ...
        e.Query = myDataServiceContext.Customers
    End Sub
End Class

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetSource 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.

connect-winforms-grid-to-webapi-service/CS/WinForms.Client/MainForm.cs#L12

csharp
// This line of code is generated by Data Source Configuration Wizard
this.oDataInstantFeedbackSource1.GetSource += oDataInstantFeedbackSource1_GetSource;
// This line of code is generated by Data Source Configuration Wizard

See Also

ODataInstantFeedbackSource Class

ODataInstantFeedbackSource Members

DevExpress.Data.ODataLinq Namespace