Пример #1
0
        public virtual void CreateLink([FromODataUri] TKey key, string navigationProperty, [FromBody] Uri link)
        {
            Contract.Requires<ArgumentException>(! string.IsNullOrWhiteSpace(navigationProperty));
            Contract.Requires<ArgumentNullException>(link != null);

            throw EntitySetControllerHelpers.NotImplementedResponseException(this, "Create Link");
        }
Пример #2
0
        /// <summary>
        /// Override this method to implement reading navigation properties for the entity identified by <paramref name="key"/>.
        /// The returned query should lookup the <typeparamref name="TEntity"/> by <paramref name="key"/>, and include
        /// the navigation property identified by <paramref name="edmNavigationProperty"/>.
        /// </summary>
        /// <typeparam name="TProperty"></typeparam>
        /// <param name="key">The key identifying the entity in the current entityset.</param>
        /// <param name="edmNavigationProperty">The <see cref="IEdmNavigationProperty"/> of the entity navigation property.</param>
        protected virtual IQueryable<TEntity> GetEntityWithNavigationPropertyQuery<TProperty>(TKey key, IEdmNavigationProperty edmNavigationProperty)
            where TProperty : class
        {
            Contract.Requires<ArgumentNullException>(edmNavigationProperty != null);

            throw EntitySetControllerHelpers.NotImplementedResponseException(this, "GET NavigationProperty " + edmNavigationProperty.Name);
        }
Пример #3
0
        /// <summary>
        /// This method should be overridden to handle DELETE requests that attempt to break a relationship between two entities.
        /// </summary>
        /// <param name="key">The key of the entity with the navigation property.</param>
        /// <param name="relatedKey">The key of the related entity.</param>
        /// <param name="navigationProperty">The name of the navigation property.</param>
        public virtual void DeleteLink([FromODataUri] TKey key, string relatedKey, string navigationProperty)
        {
            Contract.Requires<ArgumentNullException>(relatedKey != null);
            Contract.Requires<ArgumentException>(! string.IsNullOrWhiteSpace(navigationProperty));

            throw EntitySetControllerHelpers.NotImplementedResponseException(this, "DELETE Link");
        }
Пример #4
0
        /// <summary>
        /// Handles POST requests on navigation properties.
        /// </summary>
        /// <typeparam name="TProperty"></typeparam>
        /// <param name="key"></param>
        /// <param name="navigationProperty"></param>
        /// <param name="propertyEntity"></param>
        /// <returns></returns>
        public virtual CreatedItemResult<TProperty> PostNavigationProperty<TProperty>([FromODataUri] TKey key, string navigationProperty, [FromBody] TProperty propertyEntity)
            where TProperty : class
        {
            Contract.Requires<ArgumentNullException>(navigationProperty != null);
            Contract.Requires<ArgumentNullException>(propertyEntity != null);

            throw EntitySetControllerHelpers.NotImplementedResponseException(this, "POST NavigationProperty");
        }
Пример #5
0
        public virtual void CreateLink([ModelBinder(typeof(ChangeSetEntityModelBinder))] TEntity changeSetEntity, string navigationProperty, [FromBody] Uri link)
        {
            Contract.Requires<ArgumentNullException>(changeSetEntity != null);
            Contract.Requires<ArgumentException>(!string.IsNullOrWhiteSpace(navigationProperty));
            Contract.Requires<ArgumentNullException>(link != null);

            throw EntitySetControllerHelpers.NotImplementedResponseException(this, "Create Link");
        }
Пример #6
0
        /// <summary>
        /// Handles POST requests on navigation properties.
        /// </summary>
        /// <typeparam name="TProperty"></typeparam>
        /// <param name="changeSetEntity">An entity that was added earlier in the current changeset.</param>
        /// <param name="navigationProperty"></param>
        /// <param name="propertyEntity"></param>
        /// <returns></returns>
        public virtual CreatedItemResult<TProperty> PostNavigationProperty<TProperty>([ModelBinder(typeof(ChangeSetEntityModelBinder))] TEntity changeSetEntity, string navigationProperty, [FromBody] TProperty propertyEntity)
            where TProperty : class
        {
            Contract.Requires<ArgumentNullException>(changeSetEntity != null);
            Contract.Requires<ArgumentNullException>(navigationProperty != null);
            Contract.Requires<ArgumentNullException>(propertyEntity != null);

            throw EntitySetControllerHelpers.NotImplementedResponseException(this, "POST NavigationProperty");
        }
Пример #7
0
        /// <summary>
        /// This method should be overridden to get the entity key of the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns>The entity key value</returns>
        protected virtual TKey GetKey(TEntity entity)
        {
            Contract.Requires<ArgumentNullException>(entity != null);

            throw EntitySetControllerHelpers.NotImplementedResponseException(this, "GetKey(TEntity entity)");
        }
Пример #8
0
 /// <summary>
 /// This method should be overridden to return an <see cref="IQueryable{T}"/> that retrieves an entity by key from the entity set.  The query may
 /// be modified using query options to filter or expand the query.
 /// </summary>
 /// <param name="key">The entity key of the entity to query for.</param>
 /// <returns>A base query to retrieve the entity with key <c>==</c> <paramref name="key"/>.</returns>
 protected virtual IQueryable<TEntity> GetEntityByKeyQuery(TKey key)
 {
     throw EntitySetControllerHelpers.NotImplementedResponseException(this, "GET entity by key query");
 }
Пример #9
0
 /// <summary>
 /// This method must be overridden to support GET requests.
 /// </summary>
 /// <returns></returns>
 protected virtual IQueryable<TEntity> GetBaseQueryable()
 {
     throw EntitySetControllerHelpers.NotImplementedResponseException(this, "GET");
 }
Пример #10
0
 protected virtual void DeleteEntityByKey(TKey key)
 {
     throw EntitySetControllerHelpers.NotImplementedResponseException(this, "DELETE");
 }
Пример #11
0
        /// <summary>
        /// This method should be overridden to update an existing entity in the entity set.
        /// </summary>
        /// <param name="key">The entity key of the entity to update.</param>
        /// <param name="update">The updated entity.</param>
        /// <returns>The updated entity.</returns>
        protected internal virtual TEntity UpdateEntity(TKey key, TEntity update)
        {
            Contract.Requires<ArgumentNullException>(update != null);

            throw EntitySetControllerHelpers.NotImplementedResponseException(this, "PUT");
        }
Пример #12
0
        /// <summary>
        /// This method should be overridden to apply a partial update to an existing entity in the entity set.
        /// </summary>
        /// <param name="key">The entity key of the entity to update.</param>
        /// <param name="patch">The patch representing the partial update.</param>
        /// <returns>The updated entity.</returns>
        protected internal virtual TEntity PatchEntity(TKey key, Delta<TEntity> patch)
        {
            Contract.Requires<ArgumentNullException>(patch != null);

            throw EntitySetControllerHelpers.NotImplementedResponseException(this, "PATCH");
        }
Пример #13
0
        /// <summary>
        /// This method should be overridden to create a new entity in the entity set.
        /// </summary>
        /// <param name="entity">The entity to add to the entity set.</param>
        /// <returns>The created entity.</returns>
        protected internal virtual TEntity CreateEntity(TEntity entity)
        {
            Contract.Requires<ArgumentNullException>(entity != null);

            throw EntitySetControllerHelpers.NotImplementedResponseException(this, "POST");
        }
Пример #14
0
 public virtual HttpResponseMessage HandleUnmappedRequest(ODataPath odataPath)
 {
     throw EntitySetControllerHelpers.UnmappedRequestResponse(this, odataPath);
 }