I have 4 Tables
MusicArtist
MusicArtistGenre
MusicArtistRelationship
MusicGenre
MusicArtist has PK of ArtistID
MusicArtistGenre has PK of ArtistGenreID and FK of ArtistID (Linked to MusicArtist) and GenreID (Linked to MusicGenre)
MusicArtistRelationship has PK of ArtistRelationshipID and KF or ArtistID1 (Linked to MusicArtist) and ArtistID2 (Linked to MusicArtist)
MusicGenre has PK of GenreID
When I generate the code it creates MusicArtistEntity.MusicGenreCollectionViaMusicArtistGenre but it does not create anything like MusicArtistEntity.MusicArtistCollectionViaMusicArtistRelationship and MusicArtistEntity.MusicArtistCollectionViaMusicArtistRelationship_ (or something like that) so i'm having problems binding this prefetch list of MusicArtistEntity to a grid because i'm not sure what to use for the syntax.
The way I get the main MusicArtistEntity record with prefetch is like so:
Dim DB as IDataAccessAdapter = Ctype(GetAccessAdapter(DatabaseType.SQLServer), IDataAccessAdapter)
Dim PK as Integer = 1
Dim path as IPrefetchPath2 = new PrefetchPath2(Ctype(EntityType.MusicArtistEntity,Integer))
path.Add(MusicArtistEntity.PrefetchPathMusicArtistRelationship).SubPath.Add(MusicArtistRelationshipEntity.PrefetchPathMusicArtist_)
path.Add(MusicArtistEntity.PrefetchPathMusicGenreCollectionViaMusicArtistGenre)
Record = New MusicArtistEntity(Me.PK)
DB.FetchEntity(Record, prefetchPath)
Now I can see via the Diagnostic output that the MusicArtistEntity records are being prefetched correctly for each MusicArtistRelationship in MusicArtistEntity.
The Genre grid is straight forward:
grid1.DataSource = Record.MusicGenreCollectionViaMusicArtistGenre
What should I bind Relationship grid too using this prefetch? or do I have to go about it another way. I was hoping that I didn't need to build another EntityCollection and fill it in if I could get the data via the main records prefetch path.
Hope this makes sense.
Geoff.