This question is locked. New answers and comments are not allowed.
I'm learning OpenAccess and using an existing database so I'm reverse mapping.
I have a mapping/joining table that has 3 Primary keys that have relationships to 3 tables.
Owner Class - Track
Key Type - Industry
Value Type - IndustryType
The skeleton classes:
The "TrackIndustries" table has data like:
TrackID IndustryID IndustryTypeID
1 44 12
1 44 15
1 44 17
1 44 15
If I make a query such as:
I only get back 1 result instead of 4
Should I not use a "Map" Mapping here?
I also need to query this from the Industry class as well to say give me the Tracks where Industry == ?
I can do all this with sql easily but not sure how to do it here.
Any ideas?
If you need more info let me know.
Thanks
I have a mapping/joining table that has 3 Primary keys that have relationships to 3 tables.
Owner Class - Track
Key Type - Industry
Value Type - IndustryType
The skeleton classes:
| public partial class Track |
| { |
| //The 'no-args' constructor required by OpenAccess. |
| public Track() |
| { |
| } |
| [Telerik.OpenAccess.FieldAlias("trackID")] |
| public int TrackID |
| { |
| get { return trackID; } |
| set { this.trackID = value; } |
| } |
| [Telerik.OpenAccess.FieldAlias("trackIndustries")] |
| public IDictionary<Industry, IndustryType> TrackIndustries |
| { |
| get { return trackIndustries; } |
| } |
| } |
| public partial class Industry |
| { |
| //The 'no-args' constructor required by OpenAccess. |
| public Industry() |
| { |
| } |
| [Telerik.OpenAccess.FieldAlias("industryID")] |
| public int IndustryID |
| { |
| get { return industryID; } |
| set { this.industryID = value; } |
| } |
| } |
| public partial class IndustryType |
| { |
| //The 'no-args' constructor required by OpenAccess. |
| public IndustryType() |
| { |
| } |
| [Telerik.OpenAccess.FieldAlias("industryTypeID")] |
| public int IndustryTypeID |
| { |
| get { return industryTypeID; } |
| set { this.industryTypeID = value; } |
| } |
| } |
The "TrackIndustries" table has data like:
TrackID IndustryID IndustryTypeID
1 44 12
1 44 15
1 44 17
1 44 15
If I make a query such as:
| var items = scope.Extent<Track>().Where(t => t.TrackID == 1).SingleOrDefault().TrackIndustries; |
Should I not use a "Map" Mapping here?
I also need to query this from the Industry class as well to say give me the Tracks where Industry == ?
I can do all this with sql easily but not sure how to do it here.
Any ideas?
If you need more info let me know.
Thanks