PredicateFactory still refers to deleted Entity class

Posts   
 
    
clint
User
Posts: 150
Joined: 15-Nov-2005
# Posted on: 26-Jul-2007 20:47:00   

Version: LLBLGen Pro Version: 2.0.0.0 Final (November 6th, 2006) .NET Version: 2.0 Template: Adapter Preset: SD.Presets.Adapter.General2005

I refreshed my catalog since I removed some tables. The entities that were mapped to those table were removed. I generated the code.

The problem is that the PredicateFactory and SortClauseFactory classes still refer to the deleted entity classes. I thought that those classes would've been regenerated, but they weren't. Is this by design? Am I suppose to manually remove the code from those classes that refer to the deleted entity classes.

Thanks. - Clint

Seth avatar
Seth
User
Posts: 204
Joined: 25-Mar-2006
# Posted on: 26-Jul-2007 21:18:48   

I've had that happen before. I just went in a manually removed the files from my project and everything worked fine.

-Seth

clint
User
Posts: 150
Joined: 15-Nov-2005
# Posted on: 26-Jul-2007 22:24:36   

I just went in a manually removed the files from my project and everything worked fine.

Based on your response, I'm not sure if you understood my problem.

I'll redescribe my problem: I removed two tables from the database: CompatibleApplication and ReceiptType. I refreshed the catalog, and the CompatibleApplication and ReceiptType tables no longer showed up as entities in the LLBLGen project.

Then I regenerated the code. The old CompatibleApplication and ReceiptType classes were still in my C# project, so I removed them.

When I compile my C# project I get errors. Here is an example of one error in the PredicateFactory class:

The type or namespace name 'CompatibleApplicationFieldIndex' could not be found (are you missing a using directive or an assembly reference?)

Here is the PredicateFactory code that caused the error:


/// <summary>FieldCompareValuePredicate factory for CompatibleApplicationEntity.</summary>
public static FieldCompareValuePredicate CompareValue(CompatibleApplicationFieldIndex indexOfField, ComparisonOperator operatorToUse, object value)
{
    return new FieldCompareValuePredicate(EntityFieldFactory.Create(indexOfField), null, operatorToUse, value);
}

Why does the PredicateFactory class still contain this code even though I am no longer using CompatibleApplicationEntity? I thought that LLBLGen would've regenerated this class, but it didn't.

I suppose I could take the code out manually, but it doesn't seem proper editing generated code.

  • Clint
clint
User
Posts: 150
Joined: 15-Nov-2005
# Posted on: 26-Jul-2007 22:32:47   

I tried removing the existing PredicateFactory and SortClauseFactory classes from my C# project and deleted them from my hard drive. Then I regenerated the code. I was hoping LLBLGen would generate new PredicateFactory and SortClauseFactory classes since I deleted the old ones, but it didn't.

  • Clint
worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 27-Jul-2007 04:49:07   

I though SortClauseFactory and PredicateFactory were obsolete...

They've been replaced with operator overloads ie. new SortExpression(CustomerFields.Name | SortOperator.Ascending) or new RelationPredicateBucket(CustomerFields.Name == "Bob")

So why did u even have them in the first place?

The reason it didn't regenerate the files is probably because the task is disabled by default in the preset... but then how did it get in there in the first place... spooky.

clint
User
Posts: 150
Joined: 15-Nov-2005
# Posted on: 27-Jul-2007 06:23:44   

I though SortClauseFactory and PredicateFactory were obsolete...

So why did u even have them in the first place?

OK, that explains it. It appears that my PredicateFactory and SortClauseFactory classes were generated back when I was using LLBLGen 1.0.

Here is the comment at the top of the PredicateFactory.cs file:


// Code is generated using LLBLGen Pro version: 1.0.2005.1
// Code is generated on: Tuesday, November 14, 2006 4:32:50 PM
// Code is generated using templates: Custom C# template set for SqlServer (1.0.2005.1)
// Templates vendor: Solutions Design.
// Templates version: 1.0.2005.1.012306

I suppose I can just get rid of those classes altogether. Thanks!