How to maintain a manual relationship when refreshing the model?

Posts   
 
    
tmpcl
User
Posts: 20
Joined: 21-Sep-2006
# Posted on: 16-Sep-2010 20:14:15   

I'm using 3.0 Final.

I have a View in which I designated a "primary key" in the designer so that I could establish a relationship between it and an Entity. The relationship works great until I attempt to refresh the model to bring in any changes from the database. Once I do that I receive the results below and the manual relationship is removed.

The relationship 'db.View - db.Entity (1:1)' has been removed because its underlying foreign key constraint wasn't found in the refreshed relational model data.

How can I specify to always maintain this manually configured relationship even though it of course does not exist in the database?

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 16-Sep-2010 23:53:25   

How did you designate the PrimaryKey against the View...?

And did you sync the changes back to the database once you had made the change...?

Matt

Emmet
User
Posts: 36
Joined: 12-Jul-2005
# Posted on: 17-Sep-2010 20:35:44   

tmpcl wrote:

I'm using 3.0 Final.

I have a View in which I designated a "primary key" in the designer so that I could establish a relationship between it and an Entity. The relationship works great until I attempt to refresh the model to bring in any changes from the database. Once I do that I receive the results below and the manual relationship is removed.

The relationship 'db.View - db.Entity (1:1)' has been removed because its underlying foreign key constraint wasn't found in the refreshed relational model data.

How can I specify to always maintain this manually configured relationship even though it of course does not exist in the database?

I just ran into the same issue. In "Preferences" under the "Catalog Refresher" category set "RelationshipsFollowDBForeignKeyConstraints" to false.

The will preserve any relationship that were manually created in the designer. The only bad thing about this is you now have to manually add any new relationship that was created in your database. I think there needs to be a 3rd option (still sync the automatic relationships but keep the manual ones).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 17-Sep-2010 21:08:59   

Yes, we know this limitation and it's one of the first features we're developing into 3.1: 'model only relationships' (also for PK's and UC's). simple_smile

Frans Bouma | Lead developer LLBLGen Pro
tmpcl
User
Posts: 20
Joined: 21-Sep-2006
# Posted on: 17-Sep-2010 23:48:22   

Thanks for the feedback Frans. I will look forward to the 3.1 release and for now to continue to re-add the relationship after I refresh the model.

By the way, has anyone else reported about the designer automatically removing the s from status in entity mapping?

ApplicationStatus table becomes ApplicationStatu entity

I love all of the new features I've used in 3.0 so far. Great work!

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 18-Sep-2010 08:24:17   

tmpcl wrote:

By the way, has anyone else reported about the designer automatically removing the s from status in entity mapping?

ApplicationStatus table becomes ApplicationStatu entity

LLBLGen singularization routine assumes that table name is plural. To disable singularization follow these steps.

David Elizondo | LLBLGen Support Team
tmpcl
User
Posts: 20
Joined: 21-Sep-2006
# Posted on: 22-Sep-2010 21:07:08   

I don't want to disable singularization. I just wanted to point out that the singularization plugin is incorrectly removing the s from the singular stauts

Status is the singular form where statuses is plural.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Sep-2010 05:04:46   

tmpcl wrote:

I don't want to disable singularization. I just wanted to point out that the singularization plugin is incorrectly removing the s from the singular stauts

Status is the singular form where statuses is plural.

NamePluralToSingularConversion plugin uses Inflector, a class, which is used from the Castle Project (http://www.castleproject.org/), and which is licensed under the Apache 2.0 license.

So the set of rules applied doesn't contain an exception for "status". You can download source code from LLBLGen site (customer area) and add a regular expression rule for that specific word, recompile and copy the plugin assembly into LLBLGen's Plugin folder.

Hope that helps wink

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 23-Sep-2010 10:44:49   

Also, the system thinks that the names are plural as it does singularization. This means that if it sees 'status', it doesn't know the word as a plural exception (as it's a singular word!) and simply removes the s.

That's why disabling the singularization for databases which have singular names is better, as there's nothing to singularize as everything is already made singular.

Frans Bouma | Lead developer LLBLGen Pro