Category Archives: DevExpress

DevExpress is a popular provider for many .NET related tools, this category is for any posts related to these tools.

HOW TO: Create an XtraReport from a ReportData Object

DevExpress has a nice module for their eXpressApp Framework called the Report Module.  The purpose of this module is to provide a reporting engine for your objects and allow you to generate reports through actions and in the UI.  So far, the biggest problem I have encountered with this is how to generate these reports outside of the Framework once they are designed a ready.  A typical scenario involves having a designed application and then needing to develop some sort of service process that fetches and sends reports on a daily basis.

As a work around, I’ve found out how to generate these reports as a simple XtraReport instead of a XafReport object.  The XtraReport class can be loaded from a stream which contains the layout in a byte array.  I simply read the layout from the persistent ReportData object into a byte array and load the XtraReport from it.  Here are some code examples:


Dim uowUnitOfWork As New  UnitOfWork(XpoDefault.DataLayer)
Dim obsObjectSpace As New ObjectSpace(uowUnitOfWork, XafTypesInfo.Instance)
Dim rptReportData As Reports.ReportData
Dim xfrReport As Reports.XafReport

rptReportData = obsObjectSpace.FindObject(Of Reports.ReportData)(Nothing)
xfrReport = rptReportData.LoadXtraReport(obsObjectSpace)


using( UnitOfWork uow = new UnitOfWork( XpoDefault.DataLayer ) ) {
        ObjectSpace objectSpace = new ObjectSpace( uow , new XpoTypesInfoAdapter(
uow.DataLayer.Dictionary ) );
        ReportData reportData = objectSpace.FindObject<ReportData>( new BinaryOperator( "Name",
"ContactsGroupedByPosition" ) );
        if( reportData != null ) {
            XafReport report = reportData.LoadXtraReport( objectSpace );
            report.ObjectSpace = objectSpace;

HOW TO: Delete project Cache for CodeRush

Problem: My project cache was taking up 6GB from CodeRush, yikes!

First solution:

1. CodeRush stores cache files in the following folder
 (just copy and paste this path to the Windows Explorer):
%AppData%CodeRush for VS .NET1.1SolutionCache
2. Please delete this folder, and check if this makes a difference at your end.
3. Please look on the attched screencast.

Second solution:
(Got this solution from  Trevor Westerdahl – DX Squad

Follow these steps to create a shortcut/hotkey to delete the cache:

1. From the DevExpress menu, select “Options…”.
2. In the tree view on the left, navigate to this folder:
3. Select the “Shortcuts” options page.
4. Create a new shortcuts folder if you don’t have one already for your personal 
shortcuts. Call it “My Shortcuts”
5. Create a new shortcut (e.g., Ctrl+Shift+Alt+Z).
6. In the Command combo box, select the “Clear Project Cache” command.
7. Click OK.

XPO Upcasting & Downcasting

In XPO, when working with persistent objects, a filter allows you to upcast and downcast data.

Consider the following example:

Public Class Contact
    Inherits BaseObject

    Public Sub New(ByVal session As Session)
    End Sub

    Private _mFirstName As String
    Private _mLastName As String
    Private _mMiddleName As String

    Public Property FirstName() As String
            Return _mFirstName
        End Get
        Set(ByVal value As String)
            If String.Compare(_mFirstName, value, False) = 0 Then
            End If
            _mFirstName = value
        End Set
    End Property
    Public Property LastName() As String
            Return _mLastName
        End Get
        Set(ByVal value As String)
            If String.Compare(_mLastName, value, False) = 0 Then
            End If
            _mLastName = value
        End Set
    End Property
    Public Property MiddleName() As String
            Return _mMiddleName
        End Get
        Set(ByVal value As String)
            If String.Compare(_mMiddleName, value, False) = 0 Then
            End If
            _mMiddleName = value
        End Set
    End Property
End Class

Public Class Developer
    Inherits Contact

    Private _mLanguage as String
    Public Property Language As String
            Return _mLanguage
        End Get
        Set(Byval value As String)
            _mLanguage = value
        End Set
    End Property

End Class

When filtering these objects, you can filter developers based on their contact information, but you can also filter contacts based on their developer information, if they are example

Dim cntFilterForContact As New BinaryOperator("Language", "VB.NET")
Dim cntFilterForDeveloper As New BinaryOperator("Language", "VB.NET")

The filters can be used appropriately against the Contact or the Developer object to retrieve all developers who code in VB.NET. Very efficient stuff :)