-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Labels
Milestone
Description
This is the main reason I am not using JSONAPI.NET's ApiController implementation yet. I have a service layer that has async CRUD methods that I want to await in async WebAPI actions, but the synchronous IMaterializer interface that ApiController<> uses gets in the way.
I propose converting the interface to the following:
Task<T> GetById<T>(params Object[] keyValues);
Task<object> GetById(Type type, params Object[] keyValues);
Task<T> Materialize<T>(T ephemeral);
Task<object> Materialize(Type type, object ephemeral);
Task<T> MaterializeUpdate<T>(T ephemeral);
Task<object> MaterializeUpdate(Type type, object ephemeral);
I think this is better than supporting both sync and async versions of each method, since you can easily wrap a synchronous method result in a Task.FromResult(), if you really need to.