This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I'm using the aspnetmembership standard db. When I import the model and want to only use the 2 tables below - User and Membership I get: Column UserId is mapped multiple times in entity AspnetMembership
I've tried to follow the http://www.mindscapehq.com/forums/Thread.aspx?PostID=10482 Key Property Reference instructions. I right clicked on the arrow, and set Key Property Reference to Id.UserId It didn't work. Compiled, but blew up at run time. Problem: Have I got this Key Property Reference wrong? Cheers Dave |
|
|
The problem is that the UserId column is both the primary key and part of a foreign key. Your entity class is therefore mapping UserId as the identity column name, and as part of the foreign key field for the User association (which is of composite type, as it contains both the ApplicationId and UserId columns). You cannot get around this by setting Key Property Reference. KPR will bail you out when the FK is a single column and that column is already mapped elsewhere, but it can't help you when the FK is multiple columns and one of those columns is mapped elsewhere. In such cases the only way out is to use a custom association resolver, which can be a bit hairy I'm afraid. See the following threads for more info: http://www.mindscapehq.com/forums/Thread.aspx?ThreadID=4134 http://www.mindscapehq.com/forums/Thread.aspx?ThreadID=2653&PageIndex=2 and get back to us if you need assistance. Please also be aware that custom resolvers incur some limitations especially around eager loading and cascade delete. |
|
|
Hi Ivan Many thanks. Hmm - I think perhaps another solution would be better for me, maybe using a custom Authenticaion provider, and not trying to 'modify' fields to do what I want them to do :-) Regards Dave |
|