public static Relation ToRelation(this RelationConfig config) { return(config switch { CollectionRelationConfig collectionConfig => (Relation) new CollectionRelation( collectionConfig.CollectionAlias !, collectionConfig.RelatedEntityType !, collectionConfig.IdProperty !, collectionConfig.DisplayProperties !) { RepositoryParentSelector = collectionConfig.RepositoryParentProperty, RelatedElementsGetter = collectionConfig.RelatedElementsGetter },
internal static RelationSetup ProcessRelation(RelationConfig config) { return(config switch { CollectionRelationConfig collectionConfig => (RelationSetup) new CollectionRelationSetup( collectionConfig.CollectionAlias, collectionConfig.RelatedRepositoryType, collectionConfig.RelatedEntityType !, collectionConfig.IdProperty !, collectionConfig.DisplayProperties !) { RepositoryParentSelector = collectionConfig.RepositoryParentProperty, RelatedElementsGetter = collectionConfig.RelatedElementsGetter },
public static Relation ToRelation(this RelationConfig config) { return(config switch { CollectionRelationConfig collectionConfig => (Relation) new CollectionRelation { CollectionAlias = collectionConfig.CollectionAlias, RelatedEntityType = collectionConfig.RelatedEntityType, DisplayProperties = collectionConfig.DisplayProperties, IdProperty = collectionConfig.IdProperty, RepositoryParentIdProperty = collectionConfig.RepositoryParentIdProperty, RelatedElementsGetter = collectionConfig.RelatedElementsGetter }, DataProviderRelationConfig dataProviderConfig => new DataProviderRelation { DataCollectionType = dataProviderConfig.DataCollectionType }, _ => throw new InvalidOperationException("Invalid RelationConfig") });