With v18.2, eXpress Persistent Objects™ (XPO) includes additional community-driven feature - FetchOnlyAttribute. Applied to a class property or field, this attribute indicates that you can only read values from a database. XPO will not include these values in INSERT and UPDATE SQL statements.
public class MyClass : XPLiteObject { // ... [FetchOnly] [Persistent("Total")] private double total; [PersistentAlias("total")] public double Total { get { return total; } } }
You can also set the Fetch Only option in the Data Model Designer. In the metadata, the XPMemberInfo.IsFetchOnly property returns True for such members.
Typical scenarios
This attribute is helpful when you need to map XPO class properties to:
- Computed database columns: when it is inefficient to implement them as read-only using PersistentAliasAttribute.
- Auto-increment database columns that are not primary keys (for example, rowversion).
How can I test this feature today?
If you are an active Universal subscriber and would like to test this feature prior to the official release, download the DevExpress XAF v18.2 Preview installer. You can also use our https://nuget.devexpress.com/early-access/api Nuget package source. Check the Include prerelease option when finding and installing the package:
Image may be NSFW.
Clik here to view.
Interesting Support Center tickets
- We improved the consistency between the InMemoryDataStore and other SQL database providers (T648223);
- AddXpoDefaultUnitOfWork and other XPO extension methods for ASP.NET Core DI are not available in XPO for the full .NET Framework. This API is for the .NET Core/Standard 2.0 version only (T657285);
- We bypassed and reported a Mono bug in which a Xamarin app consumed a WCF XPO-based service (T639333);
- We discussed dynamic type usage with our recent example: How to implement a OData4 service with XPO (T654401);
- This was originally an XAF-related topic. Two long-time customers jumped in and shared their XPO related experience and performance best practices (T653665);
- A reminder that PersistentAttribute, NonPersistentAttribute and PersistentAliasAttribute are exclusive. Only one can be applied to an XPO member. In addition, there is NO NEED to explicitly mark readonly (getter only) properties with NonPersistentAttribute. Members without a public setter are treated as non-persistent automatically (from a private ticket).
Find more interesting customer questions and product enhancements for your favorite products in the DevExpress Support Center (expand the "Frameworks (XAF & XPO)" group on the right) and What's New documentation (see resolved issues).
Your feedback is needed!
What do you think about this XPO feature and the new "Interesting Support Center tickets" rubric in particular? Please let our team know in the comments.
Love XPO and want to help us promote it? Add the package through Nuget.org instead of DevExpress Nuget!
Image may be NSFW.
Clik here to view.

Yekaterina K.
Technical writer
XPO team
Clik here to view.