XPO Simplified Criteria Syntax
For some reason had some issues setting this up but in the end it all worked great.
Basically download this plugin and place it in your %USERPROFILE%\My Documents\DevExpress\IDE Tools\Community\PlugIns
http://community.devexpress.com/blogs/xpo/archive/2009/10/02/ann-dxcore-xpo-plugin-1-2-0-4.aspx
Then go into your DevExpress options (CTRL+ALT+SHIFT+O) and go to IDE > Shortcuts, I then added a new Shortcut and in my case set it to CTRL+1 then set the Use to Editor > Code> In XPO Persistent Class (this will ensure that if you press CTRL+1 outside of a XPO class it won’t run)
And now whenn you press your Shortcut within an XPO Class you should get a FieldsClass created like:
#Region "XPO nested fields class - don't edit manually"Public Shadows Class FieldsClassInherits BMS.Base.Data.BaseObject.FieldsClassPublic Sub New()MyBase.New()End SubPublic Sub New(ByVal propertyName As String)MyBase.New(propertyName)End SubPublic ReadOnly Property Title() As OperandPropertyGetReturn New OperandProperty(GetNestedName("Title"))End GetEnd PropertyPublic ReadOnly Property ID() As OperandPropertyGetReturn New OperandProperty(GetNestedName("ID"))End GetEnd PropertyEnd ClassPrivate Shared _fields As FieldsClassPublic Shared Shadows ReadOnly Property Fields() As FieldsClassGetIf ReferenceEquals(_fields, Nothing) Then_fields = New FieldsClass()End IfReturn _fieldsEnd GetEnd Property#End Region
And should be able to create Criteria like
Using Clients As New XPCollection(Of Client)(session, _New BinaryOperator(Client.Fields.AccountManager, _New OperandValue(BMS.Base.CurrentUser(session)), _BinaryOperatorType.Equal), _Nothing)For Each Client As Client In ClientsDebug.Print(Client.TradingName & " is managed by " & BMS.Base.CurrentUser(session).Fullname)NextEnd Using
Or another way I use it is for type safe binding
Private Sub Bind(ByVal control As Control, ByVal datamember As OperandProperty)control.DataBindings.Add(New Binding("EditValue", Client, datamember.PropertyName))End SubPrivate Sub frmClient_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadBind(TradingNameLabel, Client.Fields.TradingName)End Sub

Should AussieALF stay bald?
Latest Comments
- How to make XPO only...
Hi Sean, Very true ;) however keep in mi... More...
09-Apr-10 - How to make XPO only...
True, but it's worth noting that DX do ... More...
09-Apr-10 - How to make XPO only...
I would have to check with Gary, as alth... More...
09-Apr-10 - How to make XPO only...
Hi, I agree it seems like a "normal" thi... More...
09-Apr-10 - How to make XPO only...
Another question, how does it work with ... More...
09-Apr-10





