Batch conversion of Relations to Custom Relations

Posts   
 
    
dioptre
User
Posts: 66
Joined: 29-Mar-2007
# Posted on: 24-Jun-2008 06:36:17   

Hi,

Is it possible for me to convert all the database derived relations to "custom relations" in an lgp?

How would I go about it? Manually?

Cheers Andrew

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 24-Jun-2008 09:50:04   

Why do you want to do that?

dioptre
User
Posts: 66
Joined: 29-Mar-2007
# Posted on: 24-Jun-2008 09:54:39   

Many reasons...

One being a client with no control over schema.

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 24-Jun-2008 10:21:05   

I'm afraid I don't understand. Would you please elaborate in more details?

dioptre
User
Posts: 66
Joined: 29-Mar-2007
# Posted on: 24-Jun-2008 10:44:47   

It's not really important why... I just need to do it.

Basically though, the schema we are using is not necessarily going to be consistent. With custom relations, we can ensure the consistency (to a degree).

Cheers Andrew

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 24-Jun-2008 11:04:27   

Can only be done by a plugin which first removes the original relation, then adds the custom one. Or you could try to flag all relations as 'IsCustomRelation' (using the property IsCustomRelation) on the EntityRelation objects with a plugin, though I wouldn't advice it.

Our advice: Use FKs when possible. Try to use a schema which is as perfect as possible, and use that for development. If in production FKs are missing, thats not important.

dioptre
User
Posts: 66
Joined: 29-Mar-2007
# Posted on: 25-Jun-2008 02:21:11   

I have a client that insists on not using a schema (nor FKs).......

bugger eh?

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 25-Jun-2008 11:32:05   

frowning looks like a smart client?

Why does he need a relational database in the first place?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39872
Joined: 17-Aug-2003
# Posted on: 25-Jun-2008 15:47:44   

If the discussion is: the client doesn't want FK constraints in the schema, that's not important: you can develop the application with a schema WITH FK constraints, and it is perfectly usable on a schema where all FK constraints are removed: llblgen pro doesn't use meta-data from the schema at runtime, that's all generated into the code.

Frans Bouma | Lead developer LLBLGen Pro
dioptre
User
Posts: 66
Joined: 29-Mar-2007
# Posted on: 25-Jun-2008 16:26:01   

Thats why it would be handy to be able to save the generated relations as custom relations....

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 25-Jun-2008 16:41:13   

That's not needed at all, coz at runtime the appropriate joins is generated as per the schema defined at design time.

So if the actual production database is missing the FK relations, this won't cause any problem, as the joins will still be created adn executed as they should be. And the queries will be executed successfully.