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 decided to try the new drag a dbml on my model feature to see how it works. It worked well except in the multi key association naming the automatic naming of the association was Company,employee Yeah it named it with a comma. No rush I will just rename them by hand but I thought I would let you know. It will be nice to finnaly dump my linq to sql models as I only needed them for the multi field primary key support. |
|
|
Well changing it by hand didnt work. Are Multi Key associations possible yet or still on the todo list? |
|
|
It appears they are possible I had to delete the columns the associations were mapping to as they were duplicates all should be ok now (Except the initial naming of Associations)
|
|
|
It seems that when I do a lazy load of an association it throws an error var hours= (from t in tcWork.EmployeeHours foreach(var h in hours) { var e = h.Employee; //error cant find EmployeeIdEmployeeId //error cant find EmployeeIdCompany
}
I think lightspeed is not translating the multi key Id { EmployeeId, Company} Correctly |
|
|
Thanks for reporting these issues. The association loading issue is indeed because LightSpeed is not translating the column names of the multipart foreign key correctly. The foreign key field (EmployeeId) is a LightSpeed value object, so LightSpeed is trying to use its "property name + subproperty name" convention for value objects: hence EmployeeIdEmployeeId and EmployeeIdCompany. You can get around this by applying the ValueObjectColumn attribute to the foreign key field to map the subproperties to the correct columns: see http://www.mindscape.co.nz/forums/Post.aspx?ThreadID=2653&PostID=8129 for an example. The bad news is that ValueObjectColumn is not properly supported in the designer at the moment. The infrastructure is there but there's no UI for it at the moment. So you would need to either use Generation=None and write the relationship code in the partial class, or edit the .lsmodel file in an XML editor. If you want to go the latter route, the required incantation looks like this: <oneToManyAssociation ...> where valueObjectPropertyName is the name of the key property (i.e. as defined on the target entity, the entity with the composite key) and columnName is the name of the database column in the foreign key that maps to that key property. Hope that makes sense -- let me know if it's not clear. We'll aim to fix the LINQ to SQL import process so that this is handled automatically for you in future, and hopefully at some point we'll provide a UI for doing composite foreign key column mappings. Thanks again for reporting these issues. |
|