Esempio n. 1
0
 private static void AddOperationParameters(EdmOperation operation, OperationConfiguration operationConfiguration, Dictionary <Type, IEdmType> edmTypeMap)
 {
     foreach (ParameterConfiguration parameter in operationConfiguration.Parameters)
     {
         bool isParameterOptional = parameter.OptionalParameter;
         IEdmTypeReference      parameterTypeReference = GetEdmTypeReference(edmTypeMap, parameter.TypeConfiguration, nullable: isParameterOptional);
         IEdmOperationParameter operationParameter     = new EdmOperationParameter(operation, parameter.Name, parameterTypeReference);
         operation.AddParameter(operationParameter);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Adds a operation to the model.
 /// </summary>
 public virtual void AddOperation(OperationConfiguration operation)
 {
     this._operations.Add(operation);
 }
Esempio n. 3
0
        private static IEdmExpression GetEdmEntitySetExpression(IDictionary <string, EdmNavigationSource> navigationSources, OperationConfiguration operationConfiguration)
        {
            if (operationConfiguration.NavigationSource != null)
            {
                EdmNavigationSource navigationSource;
                if (navigationSources.TryGetValue(operationConfiguration.NavigationSource.Name, out navigationSource))
                {
                    EdmEntitySet entitySet = navigationSource as EdmEntitySet;
                    if (entitySet != null)
                    {
                        return(new EdmPathExpression(entitySet.Name));
                    }
                }
                else
                {
                    throw Error.InvalidOperation(SRResources.EntitySetNotFoundForName, operationConfiguration.NavigationSource.Name);
                }
            }
            else if (operationConfiguration.EntitySetPath != null)
            {
                return(new EdmPathExpression(operationConfiguration.EntitySetPath));
            }

            return(null);
        }
Esempio n. 4
0
        private static void ValidateOperationEntitySetPath(IEdmModel model, IEdmOperationImport operationImport, OperationConfiguration operationConfiguration)
        {
            IEdmOperationParameter operationParameter;
            Dictionary <IEdmNavigationProperty, IEdmPathExpression> relativeNavigations;
            IEnumerable <EdmError> edmErrors;

            if (operationConfiguration.EntitySetPath != null && !operationImport.TryGetRelativeEntitySetPath(model, out operationParameter, out relativeNavigations, out edmErrors))
            {
                throw Error.InvalidOperation(SRResources.OperationHasInvalidEntitySetPath, String.Join("/", operationConfiguration.EntitySetPath), operationConfiguration.FullyQualifiedName);
            }
        }