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
|
Hi there, Regarding a ManyToMany association using an explicit through entity - e.g. the ContributionTags example - What's the correct syntax for specifying a value for 'CreatedBy' on the associative entity when creating it? Thanks. |
|
|
LightSpeed will assign these values automatically provided you have set the AuditInfoMode on your LightSpeedContext. Have a read through this page from the documentation: http://www.mindscapehq.com/documentation/lightspeed/Implementing-Storage-Policies-with-LightSpeed/User-Ids-for-Entity-Tracking-and-Soft-Deletion for details on how to set this up.
|
|
|
Sorry, my mistake - was just using that as an example. I have an explicit through entity ( Roles --> RoleQuestions (includes Weight) <-- Questions At the moment I'm using |
|
|
A simple way to do this would be to create the RoleQuestions instance e.g.
This performs the wireup directly through property assignment so you dont actually need to do anything else with the object after that other than as needed by your application. Because this is associated with both role and question it will be picked up for persistance when you call UnitOfWork.SaveChanges(). If you want to go with the approach you are already using then you could get the reference to the specific RoleQuestions instance after the fact by looking for the instance in the RoleQuestions collection on either the role or the question - e.g.
and then assign the Weight on that.
|
|
|
That's awesome thanks Jeremy. |
|