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 have two tables Titles ( TitleId int (auto gen), Title varchar(50), Description text, Status int ) And TitleInfo ( TitleId int (No auto gen), Attribute1 varchar(50), Attribute2 varchar(50) ) TitleInfo was created many years ago via a trigger and for whatever reason there is no auto number field. There is also no foreign key defined in the sql server 2005 database. So I created a one to one association in the designer. Now the trick here is that I want to return a resultset of TitleInfo based on a where clause that exists in the title table.
var results = uow.TitleInfo.Where(w => w.Title.Status != 20).Take(500) I get the following error {"The column 't0.TitleId' was specified multiple times for 't0'."} And If I log, I do see TitleId as the first column and as a column f Please tell me if you need more information |
|
|
The Take statement is not needed to reproduce the issue that 't0.TitleId' is in the result set multiple times. It does not blow up when the cross table where statement is used so this may be an issue for multiple join conditions. Thanks Joe |
|
|
This occurs because the TitleId column is being mapped to both the Id property (because it is the unique identifier of a TitleInfo) and to the "foreign key field" for the TitleInfo -> Title association. (I know it's not a FK in the database but LightSpeed still needs an XxxId field for the association.) Foreign keys which are also identity columns are not directly supported. For workarounds, see http://www.mindscape.co.nz/forums/Post.aspx?ThreadID=2447&PostID=7155. |
|