-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add draft support for adding/removing/modifying other data elements in dataProcessWrite #809
Add draft support for adding/removing/modifying other data elements in dataProcessWrite #809
Conversation
…new dataProcessor
…n dataProcessWrite
src/Altinn.App.Core/Internal/Data/CachedInstanceDataAccessor.cs
Outdated
Show resolved
Hide resolved
src/Altinn.App.Core/Internal/Data/CachedInstanceDataAccessor.cs
Outdated
Show resolved
Hide resolved
src/Altinn.App.Core/Helpers/Serialization/ModelSerializationService.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IInstanceDataAccessor
feels a lot more important now then the name suggest, maybe we should consider a new name before we merge to main?
Do you have any suggestions? edit: We decided to split the interface into IInstanceDataAccessor and IInstanceDataMutator which inherits from the former |
* Use IInstanceDataMutator for actions * Return List instead of dictionary for models and validation issues in MultipleDataPatch for improved swagger doc * New IDataWriteProcessor interface with IInstanceDataMutator and change list to mimik IValidator * IValidator gets ShouldRunForTask(string taskId) so that * Required validators only runs for tasks with layout. * Expression validators only runs for tasks with datatypes that has expressions validation files * Revert DataElementIdentifier to a simple wrapper for Guid (that caches the string version)
Merging this now, so that we get back to having only one PR |
The main goal is to add a method to
IDataProcessor
that takes anIInstanceDataAccessor
and a list of changes and to add methods toIInstanceDataAccessor
to add and remove data elements.Major refactorings
ModelSerializationService
to handle (de)serialisation of json and xml with convenience methods*Storage
that looks in applicationmetadataIInstanceDataAccessor
with methods to add and remove data elements from the instanceCachedInstanceDataAccessor
with functionality to ensure that nothing has been changed, after a certain point. This is used so that after data processing we can save to storage in parallel with validation without having to worry about validators mutating the models undetected.DataElementId
was previously intended to be a thin wrapper aroundSystem.Guid
, to communicate that this isn't just any guid, but a Guid from a specific database column. Every time I created one it was from aDataElement
, and it was often required to get the data type, so I added fields to avoid lookups. Now it is more of an Immutable DataElement. Not sure everybody loves that development.DataClient
uses the newModelSerializationService
andIDataClient
gets a newGetDataBytes
to argument the oldGetBinaryData
for those who want a cleanbyte[]
that isn't wrapped in aStream
.Open questions
IDataProcessing
interface, or just extend the existing with a new method. What to call the new one in that case?MemoryAsStream
in order to be able to passReadOnlyMemory<byte>
to functions that expects a stream. I also found an alternative in Windows Developer Toolkit. I'm not sure it is worth including a full toolkit for 14 effective lines of code.Remaining updates to make old code conform to new patterns
ModelDeserializer
and useModelSerializationService
everywhere.IInstanceDataAccessor
instead ofIDataClient
in more places where it makes sense to use the new data-processing interfaceRelated Issue(s)
Verification
Documentation