Skip to content
.NET, WinForms, XPServerModeView, XPInstantFeedbackView, eXpress Persistent Objects
Branch: 19.1.3+
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CS
VB
.gitattributes
.gitignore
LICENSE
README.md
config.json

README.md

How to Bind Data to WinForms Data Grid Using XPO and XPServerModeView or XPInstantFeedbackView

These new read-only server mode components are mixtures of XPServerCollectionSource/XPInstantFeedbackSource and XPView for use with DevExpress Grid controls.

They offer the following:

  • Ability to handle large data sources with lower memory usage (will not load entire persistent object instance).
  • Ability to customize SELECT statements and exclude unused data columns.
  • Ability to Include reference property data in the root query to avoid the 1+N problem.
  • Ability to Include custom (virtual) properties calculated on the server side (similar to ViewProperty).

How it works

Before using these components as a grid's data source, configure them as follows:

  1. Set ObjectType and Properties in code or in the component designer. ServerViewProperty supports persistent or aliased properties in expressions.
xpServerModeView1.ObjectType = typeof(Order);
xpInstantFeedbackView1.ObjectType = typeof(Order);

var viewProperties = new ServerViewProperty[] {
    new ServerViewProperty("Oid", SortDirection.Ascending, "[Oid]"),
    new ServerViewProperty("OrderDate", SortDirection.None, "[OrderDate]"),
    new ServerViewProperty("Customer", SortDirection.None, "[Customer.ContactName]"),
    new ServerViewProperty("ProductName", SortDirection.None, "[ProductName]"),
    new ServerViewProperty("Price", SortDirection.None, "[Price]"),
    new ServerViewProperty("Quantity", SortDirection.None, "[Quantity]"),
    new ServerViewProperty("TotalPrice", SortDirection.None, "[Quantity] * [Price]"),
    new ServerViewProperty("Tax", SortDirection.None, "[Quantity] * [Price] * 0.13")
};
xpServerModeView1.Properties.AddRange(viewProperties);
xpInstantFeedbackView1.Properties.AddRange(viewProperties);
  1. Handle the ResolveSession event to provide a Session, to retrieve objects from the data store.
session = new Session(XpoDefault.DataLayer);

xpServerModeView1.ResolveSession += (s, e) => {
    e.Session = session;
};

xpInstantFeedbackView1.ResolveSession += (s, e) => {
    e.Session = session;
};
  1. For XPInstantFeedbackView, optionally handle the DismissSession event to manually dispose of the Session created in the ResolveSession event handler.
xpInstantFeedbackView1.DismissSession += (s, e) => {
    IDisposable session = e.Session as IDisposable;
    if (session != null) {
        session.Dispose();
    }
};

Your feedback matters!

These components are in preview in v19.1 and we hope to polish and release them with your help in v19.2. We will provide API reference and more documentation for these components by the release time. Please let us know if you experience any issues, unsupported scenarios or just have usage questions.

You can’t perform that action at this time.