I suggest you ...

Support for response warnings on read-only properties

Imagine you have large DTOs that are ushared for GET, POST and PUT.

Some properties might only be used for display purposes, and cannot be updated (i.e. denormalized fields).

You might also allow the setting of a property on POST, but not on PUT. For example, you might not allow the Id of an object to be set on POST (because it will be the primary key identity insert), but if you want to update it, you can pass it in a PUT:

We currently are doing this using a custom attribute and interface on the models and model properties.

[ReadonlyRequest(ApplyTo.Post, null)]
public int? Id { get; set; }

Before each request we build up a list of warnings that we add to the request context. We also remove / set the default on any properties using this attribute.

After the request is processed, we automatically add a list of warnings to the ResponseStatus.

The calling client then knows based on the response, which of the data they have passed will simply be ignored.

1 vote
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Ben Powell shared this idea  ·   ·  Admin →

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base