public OperationImportSegment(IEnumerable <IEdmOperationImport> operationImports, IEdmEntitySetBase entitySet) : this() { // DEVNOTE: This ctor is only used in Select and Expand currently. ExceptionUtils.CheckArgumentNotNull(operationImports, "operations"); this.operationImports = new ReadOnlyCollection <IEdmOperationImport>(operationImports.ToList()); // check for empty after we copy locally, so that we don't do multiple enumeration of input ExceptionUtils.CheckArgumentCollectionNotNullOrEmpty(this.operationImports, "operations"); // Determine the return type of the operation. This is only possible if all the candidate operations agree on the return type. // TODO: Because we work on types and not type references, if there are nullability differences we'd ignore them... IEdmType typeSoFar = this.operationImports.First().Operation.ReturnType != null ? this.operationImports.First().Operation.ReturnType.Definition : null; if (typeSoFar == null) { // This is for void operations if (this.operationImports.Any(operation => operation.Operation.ReturnType != null)) { typeSoFar = UnknownSentinel; } } else if (this.operationImports.Any(operationImport => !typeSoFar.IsEquivalentTo(operationImport.Operation.ReturnType.Definition))) { typeSoFar = UnknownSentinel; } this.computedReturnEdmType = typeSoFar; this.entitySet = entitySet; this.EnsureTypeAndSetAreCompatable(); }