|
XPO_EasyFields
Allows for use of XPO Simplied Criteria Syntax (creates/updates the PersistentBase.FieldsClass of your object, for easy field reference)
IntroductionXPO Simplified Criteria Syntax allows you to obtain your persistent objects properties via Object Orientated method. This is plugin is meant to replicate Oliver Sturms XPOFieldSync, and hopefully in time improve from the excellent idea of Olivers. Instead of: Dim MyCustomersStartingWithB as XPCollection(Of Customer)(New BinaryOperator("CompanyTradingName", "B%", Like)) After running XPOEasyFields you can now do: Dim MyCustomersStartingWithB as XPCollection(Of Customer)(New BinaryOperator(Customer.Fields.CompanyTradingName, "B%", Like)) This not only easier to identify fields and relations via Intellisense, but is Strongly Typed, meaning if you wanted to Refactor your object and change the CompanyTradingName property to say TradingName, you will end up with Compile Errors highlighting where you have used that field, unlike the string representation which is perfectly valid code until it executes at Runtime and collapes in a heap ;) There are some differences between XPO_EasyFields and XPOFieldSync
Configuration
There are currently 6 options (as per 1205) Update from Class Name OnlyBy default in the Refactor! menu that appears when you press your Refactor! key you can have the Command to perform the Update XPO FieldsClass anywhere within your persistent class, if you only want it available while the caret is within the Class Name you can tick this option. Perform Update on SaveThis is pretty self-explanitory, when the document is saved, the Update XPO FieldsClass will be performed on any Persistent classes within the document Don't replace Property/VariableBy default XPO_EasyFields will replace all code (ie. Fields property, Fields variable and FieldsClass nested class) if you wish to make a slight change to your Fields property or Fields variable (such as reordering the keywords of the property to comply with StyleCop) you can enable this option and if the Property or Variable are found it won't replace them. Include Non-Persistent PropertiesYou can specifically ask XPO_EasyFields to include members that are marked Non-Persistent, this can be useful if you are using the Field references for other purposes such as databinding whereby you still need access to the field regardless if it is in the database or not. Include Inherited MembersBy default everything remains the same, however this allows you to have EasyFields generate the FieldsClass using the PersistentBase.FieldsClass as it's ancestor instead of it's inherited class. This might be handy if you want to have complete seperation of your objects. (Such as if you have CreatedBy, CreatedOn in a BusinessBaseObject which MySaleDataObject inherits from, you can either have CreatedBy exposed in the Fields property through MySaleDataObject, or have to explicitly use the BusinessBaseObject to obtain that fields. Place a comment and custom formatThis allow you to have your generated FieldsClass tagged when generated, allow you to easily identify when or possibly even who generated the class. UsagePlace the caret on the Class name of your persistent object, bring up the Refactor menu and select Update XPO FieldsClass History
Future Plans
CreditsAuthor: Michael Proctor (AussieALF) with help from mentor RoryBecker ;) | |

