-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Property Default Values #30
Comments
Tony, can you please make the required ODCM Model enhancements? |
Is this work completed with PR #36? @piotrpMSFT |
This work is not yet completed. #36 was required pre-requisite work. |
We had a discussion about this item and closed on the following strategy: A property whose value is not yet assigned, whether nullable or not, will be tracked with an unknown value state. So long as the value is unknown it can be set but not retrieved. Setting the property will clear the unknown flag. Retrieving the property value will result in an exception. InvalidOperationException seems like a good candidate but we should consider whether introducing a new exception type makes sense here. Properties should only be in the unknown state in two scenarios: the containing object was created on the Client and the property was not yet initialized OR the containing object was retrieved from the server and the property is a navigation property that was not expanded. In the case that the object was created on the Client we would like to take advantage of OData Default Property Values where available. If such a value is defined then the Property will be initialized to said value and will not be unknown. A new construct akin to Nullable seems like a reasonable implementation for capturing the Unknown value state. We are looking for nearly the identical behavior of Nullable but want an independent concept since the property whose value is not yet known might itself be Nullable. Proposed names include: Fetchable, Retrievable, Initializable, Maybe, Settable. |
Default Values
Non-nullable properties that are not set on the client during object creation will typically have their values defaulted on the server and then sent back on subsequent requests. When properties do have default values they should be expressed in the client-side model. This allows for minimizing bits on the wire [values that are default need not be sent] and improves developer experiences [inspecting a 'new' object instance is representative on the server's projection of that object].
OData v4 Description
Property Default Value
Model description
The default values will be represented on the OdcmProperty type. Consider making OdcmProperty generic so that readers can be responsible for parsing the value and store it in a strongly-typed DefaultValue property.
The text was updated successfully, but these errors were encountered: