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
|
Hey guys, I was just wondering if you might be able to supply some documentation/a sample on the ThroughAssociation class Cheers, James |
|
|
Will do. Are you having any problem in particular? |
|
|
No problems and I guessed it would be used in the many to many mapping scenario where the association table made no sense but I was more looking for some info on if in the case of both parent entities being in focus if both sides would update when one side was updated and if the association table could support a payload (with updates on both sides) etc... Had a look in the docs and couldn't spot too much info so thought it must have just been something you guys had overlooked :-) Cheers, James |
|
|
Yeah it needs to be in the docs. Here's an example of how to use them: Lets say we have a may-to-many between Contribution and Tag through ContributionTags: // Contribution class public readonly EntityCollection<ContributionTag> _contributionTags public readonly ThroughAssociation<ContributionTag, Tag> _tags; Now we can write: contribution.Tags.Add(tag); And the intersection entity will automatically be created for us. We can also enumerate the tags etc. If we have extra fields on our intersection entity (ContributionTag) then we still work with those in the normal way. Cheers, Andrew
|
|
|
I've just had a chance to play around with this and thought it was very useful, however, I wasnt able to do querying through one of these through Associations, for example (based off yours above) QueryExpression query = Entity.Attribute("tags.TagName") == "test". IList <Contribution> contributions = Repository.Find<Contribution>(query);
should this be possible in the current release? I kind of thought this would work in the same sence that you could go "ContributionTag.Tag.TagName" for the query expression.
cheers Matt |
|
|
Hi Matt, I hadn't thought of this but it's a great idea. :-) I'll have a think about getting this in Cheers, Andrew. |
|