public void Apply(OperationConfiguration configuration, ODataModelBuilder model)
        {
            ActionConfiguration action = configuration as ActionConfiguration;

            if (action == null || !action.IsBindable)
            {
                return;
            }

            /*
             * // You only need to create links for bindable actions that bind to a single entity.
             * if (action.BindingParameter.TypeConfiguration.Kind == EdmTypeKind.Entity && action.GetActionLink() == null)
             * {
             *  if (action.BindingParameter.TypeConfiguration.Kind == EdmTypeKind.Entity &&
             *      action.GetActionLink() == null)
             *  {
             *      string bindingParameterType = action.BindingParameter.TypeConfiguration.FullName;
             *      action.HasActionLink(
             *          entityContext =>
             *              entityContext.GenerateActionLink(bindingParameterType, action.FullyQualifiedName),
             *          followsConventions: true);
             *  }
             * }
             * else if (action.BindingParameter.TypeConfiguration.Kind == EdmTypeKind.Collection &&
             *       action.GetFeedActionLink() == null)
             * {
             *  if (((CollectionTypeConfiguration)action.BindingParameter.TypeConfiguration).ElementType.Kind ==
             *      EdmTypeKind.Entity)
             *  {
             *      string bindingParameterType = action.BindingParameter.TypeConfiguration.FullName;
             *      action.HasFeedActionLink(
             *          feedContext =>
             *              feedContext.GenerateActionLink(bindingParameterType, action.FullyQualifiedName),
             *          followsConventions: true);
             *  }
             * }
             */
        }
 /// <summary>
 /// <see cref="OperationRestrictionsConfiguration"/> configuration
 /// </summary>
 /// <param name="operationSource">The <see cref="IEdmOperation"/> that can be built using <see cref="ODataModelBuilder"/>.</param>
 /// <returns><see cref="OperationRestrictionsConfiguration"/></returns>
 public static OperationRestrictionsConfiguration HasOperationRestrictions(this OperationConfiguration operationSource)
 => operationSource?.VocabularyTermConfigurations.GetOrCreateConfiguration <OperationRestrictionsConfiguration>();
 /// <summary>
 /// Add vocabulary annotations to a model target.
 /// </summary>
 /// <param name="model"><see cref="EdmModel"/> to add annotations to</param>
 /// <param name="target"><see cref="EdmOperation"/> to annotate</param>
 /// <param name="operationConfiguration"><see cref="OperationConfiguration"/> containing the collection of <see cref="VocabularyTermConfiguration"/> annotation configurations</param>
 public static void SetVocabularyConfigurationAnnotations(this EdmModel model, EdmOperation target, OperationConfiguration operationConfiguration)
 => model.SetVocabularyConfigurationAnnotations(target as IEdmVocabularyAnnotatable, operationConfiguration?.VocabularyTermConfigurations.Values);
示例#4
0
 /// <summary>
 /// Adds an operation to the model.
 /// </summary>
 public virtual void AddOperation(OperationConfiguration operation)
 {
     _operations.Add(operation);
 }