Metodo RelationshipManager.GetRelatedCollection<TTargetEntity>
[Questa pagina è specifica della versione 6 di Entity Framework. La versione più recente è disponibile come pacchetto NuGet per "Entity Framework". Per ulteriori informazioni su Entity Framework, vedere la pagina msdn.com/data/ef.]
Ottiene un oggetto EntityCollection<TEntity> di oggetti correlati con il nome della relazione e il nome del ruolo di destinazione specificati.
Spazio dei nomi: System.Data.Entity.Core.Objects.DataClasses
Assembly: EntityFramework (in EntityFramework.dll)
Sintassi
'Dichiarazione
Public Function GetRelatedCollection(Of TTargetEntity As Class) ( _
relationshipName As String, _
targetRoleName As String _
) As EntityCollection(Of TTargetEntity)
'Utilizzo
Dim instance As RelationshipManager
Dim relationshipName As String
Dim targetRoleName As String
Dim returnValue As EntityCollection(Of TTargetEntity)
returnValue = instance.GetRelatedCollection(relationshipName, _
targetRoleName)
public EntityCollection<TTargetEntity> GetRelatedCollection<TTargetEntity>(
string relationshipName,
string targetRoleName
)
where TTargetEntity : class
public:
generic<typename TTargetEntity>
where TTargetEntity : ref class
EntityCollection<TTargetEntity>^ GetRelatedCollection(
String^ relationshipName,
String^ targetRoleName
)
member GetRelatedCollection :
relationshipName:string *
targetRoleName:string -> EntityCollection<'TTargetEntity> when 'TTargetEntity : not struct
JScript does not support generic types and methods.
Parametri di tipo
- TTargetEntity
Tipo dell'oggetto EntityCollection<TEntity> restituito.
Parametri
- relationshipName
Tipo: System.String
Nome della relazione per la navigazione. Il nome della relazione non è qualificato con lo spazio dei nomi.
- targetRoleName
Tipo: System.String
Nome del ruolo di destinazione per la navigazione. Indica la direzione di navigazione nella relazione.
Valore restituito
Tipo: System.Data.Entity.Core.Objects.DataClasses.EntityCollection<TTargetEntity>
Oggetto EntityCollection<TEntity> di oggetti correlati.
Eccezioni
Eccezione | Condizione |
---|---|
InvalidOperationException | Il ruolo specificato ha restituito EntityReference<TEntity> anziché EntityCollection<TEntity>. |