entityrepository / ODataServer

Enhances Web API OData functionality, featuring generic OData controllers that can be generated from a domain model, including any Entity Framework DbContext.
15 stars 4 forks source link

Saving changes fails silently #12

Open johncrim opened 9 years ago

johncrim commented 9 years ago

(originally: https://entityrepository.codeplex.com/workitem/18) Posted by pawelgor on codeplex:

I had an issue the the POST method - an entity was validated and the validation threw an exception but since you're wrapping the save in a Task, then the result was returned to the client as if nothing happened.

As a quick solution I added a check to the ChangeSetExtensions.OnChangeSetSuccess:

        public static void OnChangeSetSuccess(this ODataController oDataController, Action completionFunction)
        {
            (...)

            if (task.Exception != null)
            {
                throw task.Exception;
            }
        }
johncrim commented 9 years ago

We really need a test case for this.