Add a filter in the generated prefetch path

Posts   
 
    
CowHills
User
Posts: 47
Joined: 14-Mar-2007
# Posted on: 18-Jun-2009 16:25:49   

Hi,

Maybe there's already an answer to my question on the forum but I can't find it. Is it possible to add a filter in the generated PrefetchPath code?

public static IPrefetchPathElement2 PrefetchPathSale { get { return new PrefetchPathElement2(new EntityCollection<SaleEntity>(new SaleEntityFactory()), HeaderEntity.Relations.SaleEntityUsingTransactionId, (int)ORMapper.EntityType.HeaderEntity, (int)ORMapper.EntityType.SaleEntity, 0, null, null, null, null, "Sale", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany); } }

I can add a filter manually but this will disappear the moment entities are regenerated.

Tnx,

Andre

  • LLBL version 2.0.0.0 Final
  • LLBL runtime version v2.0.50727
  • .NET version: VS2008 - 9.0.21022.8 Adapter model.
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 18-Jun-2009 18:16:10   

Why do you want to do that? You can add the filter when you add the prefetchpath in your own code.

David Elizondo | LLBLGen Support Team
CowHills
User
Posts: 47
Joined: 14-Mar-2007
# Posted on: 19-Jun-2009 11:16:23   

I know I can but I was just wondering. In that case I'm always certain the filter is incorporated in the prefetchpath.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-Jun-2009 12:00:25   

No, but it's easy to add yourself: add a partial class and add another property to the class in the partial class file, the property simply grabs the original prefetchpath element and adds the filter to it and returns that. In your queries you use the property you added yourself. This survives code generation and it takes just a few lines of code simple_smile

Frans Bouma | Lead developer LLBLGen Pro