Page 1 of 1

FK Property Name on Assocition

Posted: Wed 09 Nov 2011 14:15
by PatConnelly
I have two classes Task and UserMaster.

The Task class needs two properties called CreateUser and UpdateUser, I would like to have these both be associated with UserMaster (Who's primary key is UserPK).

When I try to make the first association, a FK property is added to Task called UserPK. If I rename this to CreateUser, I get the following error:

Code: Select all

Tracker.Task' does not contain a definition for 'UserPK' and no extension method 'UserPK' accepting a first argument of type 'Tracker.Task' could be found (are you missing a using directive or an assembly reference?)	
So I removed the association and tried:
add a CreateUser property to the Task class
In the Association Editor, deselect 'Add Foreign Key Properties...'
Choose the CreateUser property from the dropdown.

I get the same error. The generated code is:

Code: Select all

            modelBuilder.Entity()
                .HasRequired(p => p.UserMaster)
                    .WithMany(c => c.Tasks)
                .HasForeignKey(p => new { p.UserPK })
                    .WillCascadeOnDelete(false);


Additional Info

Posted: Wed 09 Nov 2011 14:19
by PatConnelly
Oops, forgot to add:

Entity Developer 4.1.64 (running in VS 2010)
Entity Framework 4.2

Posted: Mon 14 Nov 2011 18:03
by StanislavK
Thank you for the report, we have reproduced the issue. We will analyze it and inform you about the results as soon as possible.

Posted: Fri 09 Dec 2011 17:06
by StanislavK
We've fixed this issue. The fix is available in the new 4.2.85 version of Entity Developer, which can can be downloaded from
http://www.devart.com/entitydeveloper/download.html
(the trial version) or from Registered Users' Area (for users with active subscription only).

For the detailed information about the fixes and improvements available in Entity Developer 4.2.85, please refer to
http://www.devart.com/forums/viewtopic.php?t=22845