Ticket T299820
Visible to All Users

Optimize the prefetch operation for collection members of associations when associated persistent classes support deferred deletion

created 9 years ago (modified 9 years ago)

The optimization is required for scenarios where the Session.PreFetch method is executed to prefetch collection properties participating in associations and objects loaded by collections support deferred deletion.

This requirement was found when researching the scenario described by our customer in this ticket: How to optimize XPO performance. The provided example illustrates the problem:

C#
internal class A : XPObject { private B _b; public A(Session session) : base(session) { } [Association("a-b"), NoForeignKey] public B B { get { return _b; } set { SetPropertyValue("B", ref _b, value); } } } internal class B : XPObject { public B(Session session) : base(session) { } [Association("a-b"), Delayed, NoForeignKey] public XPCollection<A> As { get { return GetCollection<A>("As"); } } } static void Main(string[] args) { XpoDefault.DataLayer = XpoDefault.GetDataLayer( @"Data Source=.;Initial Catalog=perf;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False", AutoCreateOption.DatabaseAndSchema); using (var uow = new UnitOfWork()) { for (int i = 0; i < 100000; i++) { var b = new B(uow); b.Oid = i; b.Save(); if (i%10000 == 0) { Console.WriteLine(i); } } uow.CommitChanges(); } using (var uow = new UnitOfWork()) { var coll = new XPQuery<B>(uow).ToList(); uow.PreFetch(coll, "As"); //start profiling foreach (var item in coll) { //FilterList takes 92% of time foreach (var a in item.As) Console.WriteLine(a.Oid); } //end profiling } }

Answers approved by DevExpress Support

created 9 years ago (modified 7 years ago)

We have implemented the functionality described in this ticket. It will be included in our next update(s).

Please check back and leave a comment to this response to let us know whether or not this solution addresses your concerns.

    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.