Current filter:
                                You should refresh the page.
                                  • Hi
                                    I working on the following scenario.
                                    Big Data contains About 50,000  Product and I want to make Current Balance Calculation to the product from Invoices Details  (each item may have thousands of rows in Invoices Details)
                                    I have tried many options but all of them kills the application performance:
                                    1- Client Side Aggregation calculation from the InvoicesDetailsCollection in the Product BO. (this kills the application performance)
                                    2- Server Side Function that is set in the Computed Column Formula and make the Field Fetch only in XAF ( I know that this method is not recommended because SQL server will execute the Function for each Row)
                                    3- Persisted Calculation that is made on server side (Invoices Details Trigger) or OnSaving Method in XAF (this will increase the time of saving for each invoice )

                                    Before Using XAF I was using Views (not tables) to view my data. for such case I was creating a schema binding indexed view and put all aggregation needed in it ( Balance, count,min values,...etc) and this gave me the best performance 

                                    I could not find the way to link a view (XPLiteObject) with a table (BaseObject ) in one to one relation and get the values of balance or other fields by referencing the view object properties.

                                    I am sure that XAF is designed to overcome such case but I cannot find the best solution.
                                    Do you have any suggestion

                                    Kind Regards,
                                    Hadi Terkawi

                                1 Solution

                                Creation Date Importance Sort by
                                Hello Hadi,

                                As far as I understand, you have managed to map a persistent class to a database view. However, it is unclear what one to one relation you mean. If you want to show all database view records that are associated with a certain Invoice, you can add a non-associated collection returning the required persistent objects to the Invoice class:

                                private XPCollection<InvoiceDetailView> calculatedDetails; public XPCollection<InvoiceDetailView> CalculatedDetails { get { if (calculatedDetails == null) { calculatedDetails = new XPCollection<InvoiceDetailView>(Session, new BinaryOperator("InvoiceID", this.Oid)); } return calculatedDetails; } }


                                Also, as an alternative to creating a database view, you can use PersistentAlias properties in conjunction with the DataView mode. In this case, expressions specified in the PersistentAlias attribute will be calculated in the SELECT query.

                                You can find performance enhancement recommendations in the How to measure and improve the application's performance article (see item 2.5.2 - Additional queries select data from other tables for dynamic values' calculation).