GetRelationInfo...() methods disappear

Posts   
 
    
Posts: 48
Joined: 14-Feb-2008
# Posted on: 12-Mar-2008 16:49:58   

Hi!

We're using LLBL 2.5 Final, Adapter template group, C#, .NET 3.5 platform and Oracle as the DB.

We have a UserDataEntity which holds some data on our active user, and which is bound through a 1:1 relation to a UserSettingsEntity object that holds the app settings for the user (the settings are stored as an XML in a CLOB, so it's only that one entity in the settings table that I need to fetch and nothing more). Up until recently we generated the UserDataEntity class to contain the UserSettings property, mapped on the relation, even though we never actually used it. The settings were loaded with this code:

UserSettingsEntity settings = adapter.FetchNewEntity<UserSettingsEntity>(UserDataEntity.Current.GetRelationInfoUserSettings());

The loaded settings were read and discarded, never stored in the UserDataEntity.Current.UserSettings property. When we chose to generate the code without the UserSettings property (we were cleaning up, a lot of these fields mapped on relations were unneccessary to us), suddenly the generated UserDataEntity class didn't have the GetRelationInfoUserSettings() method.

In short - if we don't generate the field mapped on the relation, why don't we still get the accompanying GetRelationInfo...() method? It would still be very useful regardless of the property's existence, IMO.

I would appreciate any help in clarifying this, or perhaps if someone knows whether there's another (simple simple_smile ) way to get an IRelationPredicateBucket for the purpose of the above query?

Josip Bakic

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 12-Mar-2008 17:22:52   

Did you hide the relation on either side of it?

Posts: 48
Joined: 14-Feb-2008
# Posted on: 12-Mar-2008 17:30:20   

Nope, I checked that.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 13-Mar-2008 06:05:33   

josip, you should create your own IRelationPredicateBucket: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=6581&StartAtMessage=0&#36694

David Elizondo | LLBLGen Support Team
Posts: 48
Joined: 14-Feb-2008
# Posted on: 13-Mar-2008 10:56:38   

Thank you!

Although I find the explanation for not generating the GetRelationInfo...() methods given in the other thread to be a little odd. "The name has no meaning" - how so? Even though no property is generated, the name of the property is known to the LLBL project...

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 13-Mar-2008 11:28:54   

Yes it is 'known' but only because the designer doesn't remove the relations as it then would have a problem when the project is refreshed. So it simply hides them instead of removes them/ Hiding relations is equal to removing them for the designer and code generator: the relation doesn't exist.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 48
Joined: 14-Feb-2008
# Posted on: 13-Mar-2008 11:51:29   

I'm sorry if my questions are bothersome, but I still don't quite get it. The UserDataRelations class in the generated code contains info on this relation, even though it "doesn't exist", and I presume I could even write a general method for creating an IRelationPredicateBucket based on this info and an entity, right?

In the end, we enabled the fields on the relations which we plan tu use, it's not really a big problem. I'm just curious about why this happens..

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 13-Mar-2008 18:32:21   

josip.bakic wrote:

I'm sorry if my questions are bothersome, but I still don't quite get it. The UserDataRelations class in the generated code contains info on this relation, even though it "doesn't exist", and I presume I could even write a general method for creating an IRelationPredicateBucket based on this info and an entity, right?

In the end, we enabled the fields on the relations which we plan tu use, it's not really a big problem. I'm just curious about why this happens..

Oh, I'm sorry, I didn't read the first post properly. My bad flushed

It removes this method as it's not really necessary, as the method is there for fetching the related entities for the field mapped onto the relation. The method for example adds a predicate on the PK field value of the entity you call the method on in some relation variants, (m:1, 1(fk):1(pk)). If you don't have the field, why do you need the method, as the advantage of having the field is to work with related entities more easily.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 48
Joined: 14-Feb-2008
# Posted on: 14-Mar-2008 09:44:04   

Well, it's just that the field I don't really need, but the method I do. But I can't really think of a good example right now disappointed

Thank you for your answer!