Ticket T233255
Visible to All Users

XAF, AnalysisEditorWin - How to enable Server Mode DataSource?

created 10 years ago (modified 10 years ago)

I am evaluating XAF and AnalysisEditorWin module specifically.

I saw that as of 14.2 PivotGrid does support Server Mode (https://documentation.devexpress.com/#WindowsForms/CustomDocument17856)

How do I enable Server Mode for AnalysisEditorWin in XAF?

I have tried the below in AnalysisDataBindController descendant but data is not loaded

C#
void analysisEditor_DataSourceCreating(object sender, DataSourceCreatingEventArgs e) { var objectSpace = (XPObjectSpace)ObjectSpace; var linqServerModeSource = new LinqServerModeSource(); linqServerModeSource.QueryableSource = objectSpace.Session.Query<ObjectToBeAnalyzed>(); var analysisDataSource = new AnalysisDataSource(e.AnalysisInfo, linqServerModeSource); e.DataSource = analysisDataSource; e.Handled = true; }

Thanks
Beka

Answers approved by DevExpress Support

created 10 years ago

Hello Beka.

You can leverage server mode in AnalysisEditorWin as follows:

C#
public class AnalysisServerModeDataBindController : AnalysisDataBindController { protected override void OnAnalysisControlCreated() { base.OnAnalysisControlCreated(); this.analysisEditor.DataSourceCreating += new EventHandler<DataSourceCreatingEventArgs>(analysisEditor_DataSourceCreating); } void analysisEditor_DataSourceCreating(object sender, DataSourceCreatingEventArgs e) { var objectSpace = (XPObjectSpace)ObjectSpace; Type queryType = typeof(DevExpress.Xpo.XPQuery<>).MakeGenericType(e.AnalysisInfo.DataType); var query = (IQueryable)Activator.CreateInstance(queryType, new object[]{ objectSpace.Session}); var linqServerModeSource = new LinqServerModeSource(); linqServerModeSource.QueryableSource = query; e.DataSource = linqServerModeSource; e.Handled = true; } }

However, note that LinqServerModeSource was designed for LINQ-to-SQL and may not handle all XPO queries.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.