private static void AddOperationLinkBuilder(IEdmModel model, IEdmOperation operation, OperationConfiguration operationConfiguration) { ActionConfiguration actionConfiguration = operationConfiguration as ActionConfiguration; IEdmAction action = operation as IEdmAction; FunctionConfiguration functionConfiguration = operationConfiguration as FunctionConfiguration; IEdmFunction function = operation as IEdmFunction; if (operationConfiguration.BindingParameter.TypeConfiguration.Kind == EdmTypeKind.Entity) { if (actionConfiguration != null && actionConfiguration.GetActionLink() != null && action != null) { model.SetOperationLinkBuilder( action, new OperationLinkBuilder(actionConfiguration.GetActionLink(), actionConfiguration.FollowsConventions)); } else if (functionConfiguration != null && functionConfiguration.GetFunctionLink() != null && function != null) { model.SetOperationLinkBuilder( function, new OperationLinkBuilder(functionConfiguration.GetFunctionLink(), functionConfiguration.FollowsConventions)); } } else if (operationConfiguration.BindingParameter.TypeConfiguration.Kind == EdmTypeKind.Collection) { CollectionTypeConfiguration collectionTypeConfiguration = (CollectionTypeConfiguration)operationConfiguration.BindingParameter.TypeConfiguration; if (collectionTypeConfiguration.ElementType.Kind == EdmTypeKind.Entity) { if (actionConfiguration != null && actionConfiguration.GetFeedActionLink() != null && action != null) { model.SetOperationLinkBuilder( action, new OperationLinkBuilder(actionConfiguration.GetFeedActionLink(), actionConfiguration.FollowsConventions)); } else if (functionConfiguration != null && functionConfiguration.GetFeedFunctionLink() != null && function != null) { model.SetOperationLinkBuilder( function, new OperationLinkBuilder(functionConfiguration.GetFeedFunctionLink(), functionConfiguration.FollowsConventions)); } } } }
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)); } } }