Currently, my server is utilizing C#/WebAPI while the client side is using AngularJS.
I am faced with a dilemma when it comes to formatting an HTTP DELETE request without specifying attributes in C#. Specifically, I am struggling with how to handle a method like public void Delete(MyClass m)
on a WebAPI controller which involves a class composed of value objects called MyClass
.
The reason behind opting for a hierarchical object rather than just an ID is because I am working on developing a plugin system that aims to simplify the process for programmers in terms of learning curve, coding time, and code length.
The main purpose of this plugin system is to provide CRUD (Create, Read, Update, Delete) access to EF (Entity Framework) objects. The idea is to have implementers simply adhere to an interface such as:
public interface IMyInterface<TEntity>
{
IEnumerable<TEntity> Get();
void Put(TEntity t);
void Post(TEntity t);
void Delete(TEntity t);
}
Currently, I am focusing on the Delete
functionality on the client side. However, I am encountering issues with mapping over a complex object without the need for a C# attribute like [FromUri]
in the concrete implementation. It seems that these attributes are not inherited from interfaces, causing complications when trying to make a $http.delete()
request in AngularJS without explicitly defining a key-like parameter. This can be confusing for the consuming programmer and goes against the traditional approach of passing an ID as an argument to a Delete
method.