Problems Trying To Refresh Relational Model Data From DB

Posts   
 
    
unity007
User
Posts: 10
Joined: 06-Jul-2010
# Posted on: 06-Jul-2010 21:27:32   

Hello,

I'm pretty new to LLBLGen and have been impressed so far, but I have been running into a problem in 3.0.

I have a LLBLGen project that is connected to a SQL Server 2005 Database, and whenever I try to update the changes for my entities my clicking "Refresh Relational Model Data From Database", it doesn't update all of the fields and relations, even though they are in the DB.

Any help greatly appreciated.

Thanks

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 06-Jul-2010 22:00:39   

Which bits in particular are not being refreshed? New fields not being added to entities, field properties changing, new relations not being added etc...?

Matt

unity007
User
Posts: 10
Joined: 06-Jul-2010
# Posted on: 06-Jul-2010 22:03:46   

Hey,

It's new fields not being added to entities and new relations not being added as well.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 06-Jul-2010 22:25:48   

Can you confirm that the AddNewFieldsAfterRefresh project property is set to True, it should be by default unless you've changed it.

Matt

unity007
User
Posts: 10
Joined: 06-Jul-2010
# Posted on: 06-Jul-2010 22:33:09   

It was set to Default. I changed it to true and it added the new fields. Weird. I never changed it, and it was set to default (according to the documentation, Default is true). Something similar need to be done for the relations?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 07-Jul-2010 08:57:56   

Did you define a relation in the database between some table's PK and another field with the same table in another table, and this relation was not captured by LLBLGen Pro when you did a Refresh From the Database?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 07-Jul-2010 10:10:44   

'Default' means it uses the value of the preferences setting with the same name. Did you set that to false?

Frans Bouma | Lead developer LLBLGen Pro
arschr
User
Posts: 894
Joined: 14-Dec-2003
# Posted on: 07-Jul-2010 14:19:38   

'Default' means it uses the value of the preferences setting with the same name

I wonder if there would be a way to display the "default" value (from preferences) in a tool tip or in the text box, but with a different background color to indicate it's not set in the project but in the global preferences?

unity007
User
Posts: 10
Joined: 06-Jul-2010
# Posted on: 07-Jul-2010 20:41:01   

Walaa wrote:

Did you define a relation in the database between some table's PK and another field with the same table in another table, and this relation was not captured by LLBLGen Pro when you did a Refresh From the Database?

Yes, this is exactly what seems to be happening. I'm not sure why it's not picking up the relations.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 07-Jul-2010 21:28:24   

arschr wrote:

'Default' means it uses the value of the preferences setting with the same name

I wonder if there would be a way to display the "default" value (from preferences) in a tool tip or in the text box, but with a different background color to indicate it's not set in the project but in the global preferences?

That's very difficult to do, unfortunately, due to the nature of the property grid we're using... but indeed it's something which could be a bit more intuitive. The only problem is: everything you see in the grid is static info: attributes and types on an object. So it's not easy to make that dynamic (as the property grid uses reflection to obtain the info.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 07-Jul-2010 21:29:49   

unity007 wrote:

Walaa wrote:

Did you define a relation in the database between some table's PK and another field with the same table in another table, and this relation was not captured by LLBLGen Pro when you did a Refresh From the Database?

Yes, this is exactly what seems to be happening. I'm not sure why it's not picking up the relations.

Is 'RelationshipsFollowDBForeignKeyConstraints' set to false in preferences and 'default' in project properties or 'false' in project properties?

Are both tables a mapping target of an entity?

Frans Bouma | Lead developer LLBLGen Pro
unity007
User
Posts: 10
Joined: 06-Jul-2010
# Posted on: 07-Jul-2010 21:51:03   

Otis wrote:

unity007 wrote:

Walaa wrote:

Did you define a relation in the database between some table's PK and another field with the same table in another table, and this relation was not captured by LLBLGen Pro when you did a Refresh From the Database?

Yes, this is exactly what seems to be happening. I'm not sure why it's not picking up the relations.

Is 'RelationshipsFollowDBForeignKeyConstraints' set to false in preferences and 'default' in project properties or 'false' in project properties?

Are both tables a mapping target of an entity?

Yes, both tables are a mapping target of an entity, and RelationshipsFollowDbForeignKeyConstraints is set to false. It also does not seem to be picking up constraints even though I have both IdentifyingFieldsFollowDBPrimaryKeyConstraints and UniqueConstraintsFollowDBUniqueConstraints set to true. I also tried setting them both to false, and to no avail.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 08-Jul-2010 07:43:13   

If RelationshipsFollowDbForeignKeyConstraints is set to false, then relationships won't be picked up from the database schema.

unity007
User
Posts: 10
Joined: 06-Jul-2010
# Posted on: 08-Jul-2010 22:05:11   

Ok, I have it set to true, and it seems to not pick up relations if there is a join table (and the foreign keys are defined). Do I have to go through each of these manually?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 09-Jul-2010 09:01:19   

Many-to-many relationships are only added through reverse engineering if the Project Property AutoAddManyToManyRelationships is set to true (default is false).