odata.net
odata.net copied to clipboard
Refactor OData.Edm model classes to allow callers to update the model after reading it
The common case is for a model to be read from a file. When this happens, the returned model cannot be further updated. Callers should be able to modify the model after reading it from a source but before using it.
This might be possible in 7.x. Depending on how the other investigations around models, validation, caching, etc. we will probably want to introduce this alongside those changes in 8.0.
I am adding context from one of our investigations meetings to each of the EDM related work items. Please keep these scenarios in mind when investigating this work item:
It has been suggested (by myself) that removing the EDM interfaces and replacing them with concrete types where appropriate would be a good idea. 2 existing scenarios were enumerated for why the interfaces are necessary, 1 existing scenario was enumerated for why the interfaces are helpful (but not strictly necessary), 1 known future scenario was enumerated for why the interaces continue to be necessary, and 1 potential future scenario was enumerate for why the interfaces provide existensibility that wouldn't be available with concrete types.
Existing necessary scenarios
- The interfaces are used today for mocking in unit tests
- The interfaces could be used by customers to provide custom implementations for each type
Existing helpful scenarios
- It is helpful to have a read-only view into the EDM models
Known future scenario
- We want to allow customers to update their models after, for example, the model has been read from a CSDL file. The interfaces being a read-only view give the option for the concrete types to be used for post-read modifications, with the interfaces being used once those modifications are complete.
Potential future scenario
- There is a potential scenario where the full model being loaded into memory is not necessary for a customer. With the current structure of the
IEdmModelinterface, this means that, if all other EDM types were concrete types, then any instance ofIEdmModelwould necessarily need to load portions of the model into memory even if those portions aren't used. A new implementation of non-model EDM interfaces would allow for this even though the concrete types would not.
We should keep in mind performance and concurrency expectations when reading an EDM model. Changing how models are created should not break concurrency guarantees and should continue to have reasonable during service operations.