Esempio n. 1
0
        public void Apply(OperationConfiguration configuration, ODataModelBuilder model)
        {
            FunctionConfiguration function = configuration as FunctionConfiguration;

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

            /*
             * // You only need to create links for bindable functions that bind to a single entity.
             * if (function.BindingParameter.TypeConfiguration.Kind == EdmTypeKind.Entity && function.GetFunctionLink() == null)
             * {
             *  string bindingParamterType = function.BindingParameter.TypeConfiguration.FullName;
             *
             *  function.HasFunctionLink(entityContext =>
             *      entityContext.GenerateFunctionLink(bindingParamterType, function.FullyQualifiedName, function.Parameters.Select(p => p.Name)),
             *      followsConventions: true);
             * }
             * else if (function.BindingParameter.TypeConfiguration.Kind == EdmTypeKind.Collection && function.GetFeedFunctionLink() == null)
             * {
             *  if (((CollectionTypeConfiguration)function.BindingParameter.TypeConfiguration).ElementType.Kind ==
             *      EdmTypeKind.Entity)
             *  {
             *      string bindingParamterType = function.BindingParameter.TypeConfiguration.FullName;
             *      function.HasFeedFunctionLink(
             *          feedContext =>
             *              feedContext.GenerateFunctionLink(bindingParamterType, function.FullyQualifiedName, function.Parameters.Select(p => p.Name)),
             *          followsConventions: true);
             *  }
             * }
             */
        }
Esempio n. 2
0
        public virtual FunctionConfiguration Function(string name)
        {
            FunctionConfiguration function = new FunctionConfiguration(this, name);

            _operations.Add(function);
            return(function);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a new Function that binds to Collection(EntityType).
        /// </summary>
        /// <param name="name">The name of the Function</param>
        /// <returns>A <see cref="FunctionConfiguration"/> to allow further configuration of the Function.</returns>
        public FunctionConfiguration Function(string name)
        {
            Contract.Assert(ModelBuilder != null);
            FunctionConfiguration configuration = ModelBuilder.Function(name);

            configuration.SetBindingParameter(BindingParameterConfiguration.DefaultBindingParameterName, this);
            return(configuration);
        }
Esempio n. 4
0
        /// <summary>
        /// Create a Function that binds to this EntityType.
        /// </summary>
        /// <param name="name">The name of the function.</param>
        /// <returns>The FunctionConfiguration to allow further configuration of the new Function.</returns>
        public FunctionConfiguration Function(string name)
        {
            Contract.Assert(_configuration != null && _configuration.ModelBuilder != null);

            FunctionConfiguration function = _configuration.ModelBuilder.Function(name);

            function.SetBindingParameter(BindingParameterConfiguration.DefaultBindingParameterName, _configuration);
            return(function);
        }
 /// <summary>
 /// <see cref="ChangeTrackingConfiguration"/> configuration
 /// </summary>
 /// <param name="operationSource">The <see cref="IEdmOperation"/> that can be built using <see cref="ODataModelBuilder"/>.</param>
 /// <returns><see cref="ChangeTrackingConfiguration"/></returns>
 public static ChangeTrackingConfiguration HasChangeTracking(this FunctionConfiguration operationSource)
 => operationSource?.VocabularyTermConfigurations.GetOrCreateConfiguration <ChangeTrackingConfiguration>();