Unable to recursive save "new" entities

Posts   
 
    
worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 24-Jun-2010 06:49:33   

Cannot insert the value NULL into column 'UserId', table 'WebsiteSeo.Security.UserRole'; column does not allow nulls. INSERT fails.

I'm saving a new user and need to save a new UserRoleEntity with it.

Once upon a time I could just create a new UserRoleEntity instance, set the RoleId and add it the UserRole collection of the user entity. LLBL would take care of setting the missing UserId value. It doesn't seem to want to do that in LLBL 3.

At runtime,

user.UserRoleUsingUserId[0].Fields["UserId"].IsForeignKey

returns false...

UserRoleEntity has two fields, UserId, RoleId they are both the combined primary key. Both are FK fields.

worldspawn avatar
worldspawn
User
Posts: 321
Joined: 26-Aug-2006
# Posted on: 24-Jun-2010 07:48:07   

When I created the relationship LLBL made a new field on UserRole and was using that instead of UserId. Hence the issue.

Sorry