示例#1
0
        /// <summary>
        /// Register a factory that creates functions links.
        /// </summary>
        public FunctionConfiguration HasFunctionLink(Func <ResourceContext, Uri> functionLinkFactory, bool followsConventions)
        {
            if (functionLinkFactory == null)
            {
                throw Error.ArgumentNull("functionLinkFactory");
            }

            if (!IsBindable || BindingParameter.TypeConfiguration.Kind != EdmTypeKind.Entity)
            {
                throw Error.InvalidOperation(SRResources.HasFunctionLinkRequiresBindToEntity, Name);
            }

            OperationLinkBuilder = new OperationLinkBuilder(functionLinkFactory, followsConventions);
            FollowsConventions   = followsConventions;
            return(this);
        }
示例#2
0
        /// <summary>
        /// Register a factory that creates feed actions links.
        /// </summary>
        public ActionConfiguration HasFeedActionLink(Func <ResourceSetContext, Uri> actionLinkFactory, bool followsConventions)
        {
            if (actionLinkFactory == null)
            {
                throw Error.ArgumentNull("actionLinkFactory");
            }

            if (!IsBindable ||
                BindingParameter.TypeConfiguration.Kind != EdmTypeKind.Collection ||
                ((CollectionTypeConfiguration)BindingParameter.TypeConfiguration).ElementType.Kind != EdmTypeKind.Entity)
            {
                throw Error.InvalidOperation(SRResources.HasActionLinkRequiresBindToCollectionOfEntity, Name);
            }

            OperationLinkBuilder = new OperationLinkBuilder(actionLinkFactory, followsConventions);
            FollowsConventions   = followsConventions;
            return(this);
        }