private void ApplyProcedureConventions(ProcedureConfiguration procedure) { foreach (IProcedureConvention convention in _conventions.OfType <IProcedureConvention>()) { convention.Apply(procedure, this); } }
/// <summary> /// Remove the procedure from the model /// </summary> /// <param name="procedure">The procedure to be removed.</param> /// <returns><c>true</c> if the procedure is present in the model and <c>false</c> otherwise.</returns> public virtual bool RemoveProcedure(ProcedureConfiguration procedure) { if (procedure == null) { throw Error.ArgumentNull("procedure"); } return(_procedures.Remove(procedure)); }
private static void AddProcedureParameters(EdmOperation operation, ProcedureConfiguration procedure, Dictionary <Type, IEdmType> edmTypeMap) { foreach (ParameterConfiguration parameter in procedure.Parameters) { bool isParameterOptional = parameter.OptionalParameter; IEdmTypeReference parameterTypeReference = GetEdmTypeReference(edmTypeMap, parameter.TypeConfiguration, nullable: isParameterOptional); IEdmOperationParameter operationParameter = new EdmOperationParameter(operation, parameter.Name, parameterTypeReference); operation.AddParameter(operationParameter); } }
private static EdmOperationImport CreateActionImport( ProcedureConfiguration procedure, EdmEntityContainer container, IEdmTypeReference returnReference, IEdmExpression expression, IEdmPathExpression pathExpression) { EdmAction operation = new EdmAction( container.Namespace, procedure.Name, returnReference, procedure.IsBindable, pathExpression); return(new EdmActionImport(container, procedure.Name, operation, expression)); }
private static IEdmExpression GetEdmEntitySetExpression(IDictionary <string, EdmNavigationSource> navigationSources, ProcedureConfiguration procedure) { if (procedure.NavigationSource != null) { EdmNavigationSource navigationSource; if (navigationSources.TryGetValue(procedure.NavigationSource.Name, out navigationSource)) { EdmEntitySet entitySet = navigationSource as EdmEntitySet; if (entitySet != null) { return(new EdmEntitySetReferenceExpression(entitySet)); } } else { throw Error.InvalidOperation(SRResources.EntitySetNotFoundForName, procedure.NavigationSource.Name); } } else if (procedure.EntitySetPath != null) { return(new EdmPathExpression(procedure.EntitySetPath)); } return(null); }
private static void ValidateProcedureEntitySetPath(IEdmModel model, IEdmOperationImport operationImport, ProcedureConfiguration procedure) { IEdmOperationParameter procedureParameter; IEnumerable <IEdmNavigationProperty> navPath; IEnumerable <EdmError> edmErrors; if (procedure.EntitySetPath != null && !operationImport.TryGetRelativeEntitySetPath(model, out procedureParameter, out navPath, out edmErrors)) { throw Error.InvalidOperation(SRResources.ProcedureHasInvalidEntitySetPath, String.Join("/", procedure.EntitySetPath), procedure.FullyQualifiedName); } }
private static void AddProcedureLinkBuilder(IEdmModel model, IEdmOperation operation, ProcedureConfiguration procedure) { if (procedure.BindingParameter.TypeConfiguration.Kind == EdmTypeKind.Entity) { ActionConfiguration actionConfiguration = procedure as ActionConfiguration; IEdmAction action = operation as IEdmAction; FunctionConfiguration functionConfiguration = procedure as FunctionConfiguration; IEdmFunction function = operation as IEdmFunction; if (actionConfiguration != null && actionConfiguration.GetActionLink() != null && action != null) { model.SetActionLinkBuilder( action, new ActionLinkBuilder(actionConfiguration.GetActionLink(), actionConfiguration.FollowsConventions)); } else if (functionConfiguration != null && functionConfiguration.GetFunctionLink() != null && function != null) { model.SetFunctionLinkBuilder( function, new FunctionLinkBuilder(functionConfiguration.GetFunctionLink(), functionConfiguration.FollowsConventions)); } } }
/// <summary> /// Adds a procedure to the model. /// </summary> public virtual void AddProcedure(ProcedureConfiguration procedure) { _procedures.Add(procedure); }