Quantcast
Channel: XAF Team Blog
Viewing all articles
Browse latest Browse all 148

What's New in 13.2.8 for the eXpressApp Framework (XAF)

$
0
0

ReportsV2

With XAF v13.2.8, you are now able to use ReportsV2 and the previously available Reports modules within the same application. This is good news for those who want to maintain use of existing reports along-side of new reports generated with XAF's ReportsV2 module.

How it works?

  1. Open the Application Designer for your existing XAF application (one that is using the previously released Reports module) and drop the new ReportsV2  module from the Visual Studio Toolbox:



  2. Create and design a regular XtraReport in Visual Studio, use the new ReportsV2 data sources and then register the report to display it within XAF's application UI.

  3. Run the application and see both legacy and new reports functioning side by side:



    Note that I also renamed the navigation items so you can distinguish between Old and New.


What is next?


We have received lots of positive feedback from our customers and plan to officially release ReportsV2 in 14.1 (due late May 2014).  We will be improving the existing documentation and adding more examples to highlight popular scenarios.



EFDataView - when flexibility and performance matters


The EFDataView is our new data source that allows arbitrary combinations of calculated and aggregated values to be retrieved from an
Entity Framework data model.

As a lightweight read-only list of data records, the EFDataView retrieves records from a database without loading complete entity objects. This list can be queried much more quickly than a real objects collection. If you are familiar with XPO, think of EFDataView as an analog of the XPView component.


How it works?


To create an instance of the EFDataView, pass an EFObjectSpace
instance to the EFDataView constructor or use the IObjectSpace.CreateDataView method. The data view column names and expressions used to compute column values are specified via the Expressions list. By default, this list is empty and you should populate it manually. Both simple properties and complex expressions can be passed to the EFDataView constructor or IObjectSpace.CreateDataView method via the expressions parameter. The valid separator is a semicolon:

EFDataView dataView = new EFDataView(objectSpace, typeof(Product), "ID;Name;Sales.Sum([Count] * Price)", null, null);


The data can also be filtered and sorted via the criteria and sorting parameters:

List<DataViewExpression> dataViewExpressions = new List<DataViewExpression>();
dataViewExpressions.Add(new DataViewExpression("Count", new AggregateOperand("Sales", Aggregate.Count)));
CriteriaOperator criteria = new BinaryOperator("Sales.Count", 0, BinaryOperatorType.Greater);
SortProperty[] sorting = new SortProperty[] {new SortProperty("Name", SortingDirection.Ascending)};
EFDataView dataView = new EFDataView(objectSpace, typeof(Sale), dataViewExpressions, criteria, sorting);

Data records are not retrieved from the database when the EFDataView object is created. Instead, the database is queried when you access a specific record by its index or call one of the following methods for the first time: IBindingList.Find,IEnumerable.GetEnumerator,Contains,CopyTo,Count,IndexOf.

Later, the cached data records are used by these methods. To refresh data, use the Reload method which clears the cache.

You can limit the number of retrieved data records by using the TopReturnedObjectsCount property.


Primary usage scenarios

1. Data source for a visual data-aware control.

Since the EFDataView implements the IBindingList and ITypedList interfaces, it can serve as a data source for a visual data-aware control, e.g. the grid, chart, pivot or any other. For instance, you can now use this component “as is” on a custom form  that retrieves data from the database via Entity Framework.

2. Fast and lightweight data calculations in custom business logic.

The EFDataView retrieves only required data and not entire persistent entities as well as provides great filtering and sorting capabilities. It is perfect to perform quick data calculations as your business logic dictates.
As an example, when you access a particular data record by its index, a lightweightIDataRecord object is returned:

IDataRecord dataRecord = dataView[0];

Now to get a column value within a particular data record, use the IDataRecord.Item property as follows:

int id = dataView[0]["ID"];

Here, the "ID" string is the name of the column within the Expressions list. If you use the semicolon-separated string to specify the columns set in the EFDataView constructor, the column name coincides with the expression text:

int total = dataView[0]["Sales.Sum(Count * Price)"];

What’s next?


We want to give an XAF user the flexibility to configure the ListView’s data source mode depending on the required functionality. This will be possible without writing any code, but rather via a setting in the Model Editor. For instance, Currently the ListView operates with entire persistent objects by default, but there will also be a built-in setting to enable the “Data View” mode to achieve a greater performance in certain scenarios (e.g., for analytics and reporting involving large volumes of data).  By introducing the new ViewDataSource component for our new ReportsV2 module in v13.2 we are already on our way to offering more flexibility for an XAF user. As our upcoming release of 14.1 draws near I will be able to share more details, so stay tuned.


Viewing all articles
Browse latest Browse all 148

Trending Articles