Search This Blog

Monday, March 26, 2018

Integrating UnitOfWork and XPObjectSpace descendants into an XAF app

We've made some code changes for v17.2.6+ as well as created two articles for advanced XAF developers who may need the subject for some low-level tuning:

Sub-classing is itself easy.  The most interesting part comes for the two popular security configurations: the Integrated  mode and the Middle-Tier Application Server. Thankfully, this is rarely required for complex or specific scenarios only.  Here are several customer tickets for your reference:

    How to map a property to a calculated database column (implement a read-only persistent property)
    xpo and sql server identity fields
    Using inherited UnitOfWork object
    XAF: Create CreateCustomObjectSpaceProvider with parameters from login window
    SecurityStrategyComplex: How to modify objects/properties in code when the user does not have the permission?

To learn more about low-level options to control how your application saves data and where, check out the How to customize the underlying database provider options and data access behavior in XAF.

Your feedback is needed!
Finally, I am just curious: if you search your entire solution in Visual Studio (Control+Shift+F) for any of the ": UnitOfWork", ": XPObjectSpace", ": XPObjectSpaceProvider" strings or their VB.NET equivalents (e.g., Inherits UnitOfWork), how many occurrences  would you have and for what? Please let me know in the comments! Eaton


  1. In my case I use ObjectSpace if make any data processing in BO or in View Controller. If I call any method from view Controller I pass View.ObjectSpace to called method.
    Unit of Work I use in independent processes called from services or another exe apps. This is better imho for processing large data files.

    Few time I have to change using of OS to UoW because I want to use LINQ to query data, and there is easy way to translate line to query for xp collection. I cat find how to do with ObjectSpace code like below: :

    _filter = XPQuery.TransformExpression(unitOfWork,
    Faktury => Faktury.Mail == null &&
    Faktury.Klient.NUMERKLIENTA == nrklienta);

  2. about numbers:
    ObjectSpace 350 ocurrences
    UoW 90
    XpObjectSpace 30

    1. kashiash, thanks for your feedback. I actually meant the number of descendants, not usages of View.ObjectSpace or UnitOfWork APIs.