Skip to content
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

Use extension methods instead of properties for convenience methods on IInstantanceDataAccessor #907

Merged
merged 2 commits into from
Nov 22, 2024

Conversation

ivarne
Copy link
Member

@ivarne ivarne commented Nov 14, 2024

This is a cleanup effort, because after trying to use IInstanceDataAccessor, I wanted some changes.

The main change is to the interface that gets extension methods instead of a few properties with default implementations.

Interface properties with default implementations has a few drawbacks.

  • They need to be mocked individually, because Moq does not use the default implementation
  • They typically only serve as a starting point for futher filtering using linq. An extension methdod takes an argument (task/dataType) which is easier to understand than a linq .Where filter.

Another benefit is that we encapsulate appMetadata so that user code has even less reason to deal with dataType

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)
  • All tests run green

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

@ivarne ivarne added the feature Label Pull requests with new features. Used when generation releasenotes label Nov 14, 2024
@ivarne ivarne force-pushed the feat/dataAccessorHelperImprovements branch 3 times, most recently from 44219c7 to da31cdd Compare November 15, 2024 22:54
…n IInstantanceDataAccessor

Interface properties with default implementations has a few drawbacks.

* They need to be mocked individually, because Moq does not use the default implementation
* They typically only serve as a starting point for futher filtering using linq. An extension methdod takes an argument (task/dataType) which is easier to understand than a linq .Where filter.

Another benefit is that we encapsulate appMetadata so that user code has even less reason to deal with dataType
@ivarne ivarne force-pushed the feat/dataAccessorHelperImprovements branch from 75e2887 to 7a57d06 Compare November 22, 2024 09:25
Copy link

sonarcloud bot commented Nov 22, 2024

@ivarne ivarne merged commit f492381 into main Nov 22, 2024
11 checks passed
@ivarne ivarne deleted the feat/dataAccessorHelperImprovements branch November 22, 2024 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Label Pull requests with new features. Used when generation releasenotes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants