Repository navigation
Add an immutable typed filter builder for DTO selection - #207
Closed
jogibear9988 wants to merge 3 commits into
Closed
jogibear9988 wants to merge 3 commits into
jogibear9988 wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add an explicit immutable
Filter<T>alternative to the lambda API in #206. Callers identify DTO properties with typed selectors and compose named comparison operations.Public API
The
Select<T>extension andFilter<T>are inDotNetProjects.Migrator.Framework. Public signatures:DTO used in the examples
This uses the DTO mapping introduced in #206, including inherited properties and standard column/not-mapped attributes.
Usage
Assuming
provideris the migration'sITransformationProvider:Inside a Classic migration, use
Database.Select<ScreenDto>(table, filter); in aFluentMigration, useContext.Select<ScreenDto>(table, filter). Reads execute immediately and return materialized DTOs.Supported behavior and limits
TValueconnects the selected property type to the comparison value type. Selectors must name direct mapped properties in their declared type; casts, calculations, nested properties and widened/boxed selectors are rejected.And,OrandNotreturn new immutable filters and preserve grouping.Select<T>(table)to read all rows.Part 2 of the implementation for #202. Depends on #206; merge #206 first, then retarget this PR to master. The current base is
codex/dto-select-predicates, so this diff contains only the builder additions.Validation: