Problem with ExcludeIncludeFieldsList

Posts   
 
    
ggpnet
User
Posts: 21
Joined: 07-Apr-2005
# Posted on: 08-Oct-2007 12:55:41   

I use:

LLBLGen 2.5 - Release 10.05.2007 Firebird 2.0.1 FirebirdClient 2.0.1

I'm not absolutely sure because I don't know if am missing something or doing something wrong, but I think the ExcludeIncludeFieldsList doesn't work.

This is the test:

private void FillCollection()
{
    EntityCollection<SomeEntity> someCollection = new EntityCollection<SomeEntity>();
    
    ExcludeIncludeFieldsList myIncludeExcludeFields = new ExcludeIncludeFieldsList();
    myIncludeExcludeFields.Add(SomeFields.Country);
    myIncludeExcludeFields.Add(SomeFields.City);
    
    using (DataAccessAdapter adapter = new DataAccessAdapter())
    {
        adapter.FetchEntityCollection(someCollection, null, 0, null, null, myIncludeExcludeFields);             
    }

    dgTest01.SetDataBinding(someCollection, string.Empty);
    dgTest01.RetrieveStructure();
}

Always retrieves all the Fields, even if I change ExcludeContainedFields the resulset is the same, all the Fields, like whether ExcludeIncludeFieldsList does nothing.

Regards Gianfranco

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 08-Oct-2007 15:46:38   

Are these FK fields? FK fields are ignored as excluded fields.

Frans Bouma | Lead developer LLBLGen Pro
ggpnet
User
Posts: 21
Joined: 07-Apr-2005
# Posted on: 08-Oct-2007 18:52:27   

Yes Frans, those Fields are FK, hence it's working OK.

Thanks

simmotech
User
Posts: 1024
Joined: 01-Feb-2006
# Posted on: 01-May-2008 15:30:07   

Otis wrote:

Are these FK fields? FK fields are ignored as excluded fields.

Sorry to open this again but why can't FK fields be excluded?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 01-May-2008 15:39:25   

Because many FKs are keystones in the framework, for example PrefetchPaths depend on the PK-FK values.

simmotech
User
Posts: 1024
Joined: 01-Feb-2006
# Posted on: 02-May-2008 07:00:36   

Walaa wrote:

Because many FKs are keystones in the framework, for example PrefetchPaths depend on the PK-FK values.

Hmm

Yes I can see how they are needed for that but in the case we just had the only thing we needed was the PK so that we could bring back a child collection - effectively we were using the entity just as a placeholder for the child collections. It still works fine but the query showing in SQL Trace looks massive - dozens of FK fields being queried and returned for naught.

How about a flag on the ExcludeIncludeField collection which says whether or not to include FKs?

Cheers Simon

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 02-May-2008 09:22:20   

That will lead to problems sooner or later. The FK's aren't excluded as they're needed for operations with the code. Similar to PK values, which are also not excludeable.

The thing is that this then pops up at the point where you don't expect it. Sure, if you know what you're doing, what could possibly go wrong, right? sunglasses . The thing is that.. in this case, it's not that easy. Discriminator fields are also not excluded btw. In general, these fields aren't the ones which create a lot of data, so not excluding them won't be that noticable.

Frans Bouma | Lead developer LLBLGen Pro