Version 2.0 - where is SortClauseFactory?

Posts   
 
    
Jackk100
User
Posts: 48
Joined: 11-Jan-2005
# Posted on: 14-Jul-2006 06:26:31   

Hi,

I've just started working with version 2.0. I'm cobbling together some new classes based on some code that worked with Adapter code generated in 1.x. In my 2.0 generated code, I noticed that SortClauseFactory.cs was not present in the FactoryClasses dir, nor was PredicateFactory.cs, so my SortClauseFactory.Create method calls were no longer valid.

I looked at the templates used to generate the 2.0 code and saw that the templates to generate those classes were grayed out and marked as only used for backward compatibility. I don't need backward compatibility (and have moved that to the bottom of the list in the generator), as long as there is a new way to do the same thing, but am unable to find the new way to do the same thing.

In the docs, under "filtering and sorting, Adapter" it says:

"The SortClauseFactory.Create method has overloads which accept an object alias as well. In the previous section, Advanced Filtering, aliassing entities has been introduced, and you can refer to a specific field in a specific aliased entity by specifying the right alias with the SortClauseFactory.Create call. "

I can't find any info about how to do it without those classes in 2.0. ???

TIA, Jack

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 14-Jul-2006 08:27:25   

You can add a SortClause to SortExpressions, and SortClause has the following constructor which accept an alias.

public SortClause(
   IEntityFieldCore fieldToSort,
   IFieldPersistenceInfo persistenceInfo,
   SortOperator sortOperatorToUse,
   string objectAlias
);

Still you can generate the factory classes, simply enable their corresponding generation task in the run queue of your preset of choice (refer to LLBLGen Pro manual " Using the designer -> Generating code -> Task queue to execute tab).

Jackk100
User
Posts: 48
Joined: 11-Jan-2005
# Posted on: 15-Jul-2006 02:39:42   

Why are those two types not included by default in the generator, but are included in the docs about how to use LLBL? And why are they flagged as deprecated if the docs don't say anything about that? I'm trying to figure out what makes more sense for a new project: leave the generation defaults as is and figure out the "new" way to work without those classes, or generate those classes and work the "old way", which seems to be what the docs are about.

?

  • Jack
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 15-Jul-2006 10:12:57   

Jackk100 wrote:

Why are those two types not included by default in the generator, but are included in the docs about how to use LLBL?

They're not in the docs, if your docs have them, you might have a beta docs .chm file, as the docs have been searched for these puppies a lot to see if everything is gone.

And why are they flagged as deprecated if the docs don't say anything about that? I'm trying to figure out what makes more sense for a new project: leave the generation defaults as is and figure out the "new" way to work without those classes, or generate those classes and work the "old way", which seems to be what the docs are about. - Jack

They're still shipped for backwards compatibility. However users are discouraged to use them, hence the deprecation and the disabled state of them in the presets. They're deprecated because they can cause a lot of code to be generated in larger projects and are not that useful as there are other ways to produce predicates now (via operator overloading).

Please download the latest .chm file from the customer area and if it still tries to sell you the predicate factory class, let me know and I'll re-scan the .chm file.

Frans Bouma | Lead developer LLBLGen Pro