Repository navigation
A member of a value object that can be null, or is an enum, is read as the column - #275
Conversation
…ead as the column The value of a Nullable<T> is no segment of a path any more: x.Nick.Value.Value over a struct that can be null is the path Nick.Value (#261), and a member of a struct mapped as a complex property is read where the lambda reads it (#270). A converter written on such a property, v => v.Value.Value, names its member. A value compared with the member a converter stores is written by the property's mapping where the translator has no literal of its own: an enum as the column stores it (#262). The member's order and whether it is a boolean column are asked of the member, so a boolean member by itself is a condition (#271). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…c6f7b # Conflicts: # CHANGELOG.md
|
Review at 915b8aa: an independent reviewer (offline, two copies made with Verdict: no silent wrong answer was found. About fifty shapes of the newly accepted lambdas were tried (the member on the right, inside Before the merge, five things:
Also: Seen and not asked for here: |
…c6f7b # Conflicts: # CHANGELOG.md
Rows for a decimal, a double and a float compared through a member, with the text 11.0.0-preview.2 stores and what EF Core writes on the property (#272). A converter over a struct's own member named Value is not looked through. A path stored with the nullable's Value in it is the same object, and the two shapes that were stored wrongly are rebuilt. The parity sweep has an operand that is a member of a struct that can be null. The changelog and the guide say every input that is stored otherwise, and no longer say "as C# does". Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
The review's five points are in 2115b79, on top of
|
The review commit replaced the two bullets it rewrote up to the next heading, and took the one behind them with it. #266 is open and the bullet is as true as it was. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
The guide's bullet on #266 went by accident and is back in 7cc8a9b. The review commit rewrote the two bullets in front of it with a replacement that ran to the next heading, and took the one behind them with it. #266 is open and nothing here makes the bullet untrue. Compared with |
Closes #261
Closes #262
Closes #270
Closes #271
Problem
All four are about the member a value converter stores,
x.Email.Valuewhere the converter is written ase => e.Value(#222).Tag? Nick, C# reads the member through the nullable's ownValue. The translator made that a segment, sox.Nick.Value.Valuewas the pathNick.Value.Value, which the resolver refuses. In a key and in a condition. And a converter written on such a property,HasConversion(v => v!.Value.Value, …), was refused as one that names no member, with the advice to writeHasConversion(x => x.Value, …), which a property that can be null has no lambda for.x.Spot.Value.Citywas refused. Where the struct has a member of its own that is namedValue, nothing was refused:x.O.Value.Bwas read as that member'sB, andCREATE INDEX ix ON "Tagged" ("O_Value_B")was scaffolded for a lambda that namesO_B.x.Grade.Value == Level.HighoverGrade(Level Value)was taken where it is written and refused when the model was finalized, in the words of the call ("compares an enum"). The value is the member's and not the property's, so the model's facts had no literal for it.where: x => x.Active.ValueoverFlag(bool Value)was stored as{Active.Value} =with nothing behind the sign, andmigrations addscaffoldedWHERE "Active" =;.5.x refused #261's lambda too (read from its source at
v5.6.0, not run), so no 5.x snapshot holds such a path.Change
LambdaTranslator.PathTo):Valueof aNullable<T>is no segment of a path. One place builds a path from a member chain now, for the dispatch and for the nullability check.PropertyPaths.ConvertedMember): a converter's access to its member may go through the nullable's value,v => v.Value.Value. The walk hands the converter's own access on (Walked.Stored). The resolver still takes noValueof a nullable in a path.ModelFacts): a member that is its property's whole column answers for itself.StoredLiteral: the value is made the member's type, the conversions the converter has around the member are done to it (EF Core adds the enum's to its number: the mapping's converter isg => Convert(g.Value, Int32)), and the mapping writes the result withGenerateProviderValueSqlLiteral.KeepsOrder: the rule it had, asked of the member's type. An enum member stored as its number keeps its order.IsBooleanColumn: a boolean member that is stored as it is, is a boolean column.StoredLiteralonly where it has no literal of its own (ValueOfTheModelAlone): for an enum, and for a value of a type the spelling does not write, such as aGuid. Both were refused through a member. A stored flag without a value to compare with is refused, where it was written without one.What changes for an input
maintook. Three shapes, and nothing else:Value,x.O.Value.Bresolves toO_Bwhere it resolved toO_Value_B. The first migration after the upgrade drops and creates the object (What_was_stored_wrongly_is_dropped_and_created_as_the_lambda_says).x.Used.Value,!x.Used.Value,!!x.Used.Value, and each beside another condition with&&or||. All were stored with"Used" =and nothing behind the sign, which no server takes; each is"Used"orNOT ("Used")now, and a drop and a create from a snapshot that holds the old text (the same test, and five rows ofVouchers.Members).Value,x.W.Value.Valuewas stored as the pathW.Value.Value, the member the converter stores, and isW.Value, the property. For a declaration without a name the key moves with the path. Both are the one column: a model stored the old way diffs to nothing against the model as it is bound now, both ways, from the model and from its compiled snapshot (A_path_stored_with_the_nullables_value_in_it_is_the_same_object, which also holds that the two keys differ).No resolver method answers otherwise for a path it took, and no epoch is touched: what changed is the path the translator hands on, and a snapshot holds the path, not the lambda. A value the translator has a literal for is stored through a member as the text
mainstores, for a string, a boolean, a decimal, a double and a float (A_value_the_translator_writes_is_written_through_a_member_as_before, which passes with the three source files as onmain).Left open, as #272: a value the spelling has a literal for is still written by the spelling through a member,
{Price.Value} = 5, where the mapping writes5.0for the same comparison on the property. Handing every value to the mapping moves a stored condition, so it is a decision and not part of this.Not touched: the catalog verifier's files, the READMEs, the smoke test.
Tests
ModelFactsBindingTests(PostgreSQL package), a new model of value objects (Harness/ValueObjectModels.cs), eleven conditions:x.Rank == new VoucherRank(…). An order through a member and a boolean member by itself have no query on the property either, and are held as text;SchemaResolverTests, on Npgsql, SQL Server and SQLite, model and snapshot: paths below a struct that can be null with both forms of converter, a complex property that can be null, and the lambdas through the translator, the two rows of A member of a nullable struct complex property is refused, and one beside a member named Value is read from another column #270 among them. And the converter's twin of A member of a nullable struct complex property is refused, and one beside a member named Value is read from another column #270:d => d.Value.Textover a struct with membersValueandTextof its own is refused as a converter written otherwise, forDial.Textand forDial.Value; the snapshot takes the member, as behind any converter.ModelFactsBindingTests: the text a value is stored as through a member, beside EF Core's query on the property, which is5.0for the decimal and the double and so pins what A value compared with a member of a value object is written by the spelling, not by the property's mapping #272 would move; the stored path that moved; the two shapes that are rebuilt.x.Place!.Value.City, for which EF Core has a query. Every row over it agrees with EF Core's SQL but ten, which are the rows the block "Concatenation with a value that is not a string" already waives over a column, and are listed there.LambdaTranslatorTests: the paths, the null compensation of a member of a struct that can be null, and a stored flag without a value.SpellingParityTests(second provider): the same facts on SQL Server, against its queries for the property. There a boolean member by itself is[Done] = CAST(1 AS bit), which is also what EF Core writes for the property.Without the subject, one break at a time, each restored and rebuilt:
Valueis a segment again{Nick.Value.Value}for{Nick.Value}), 4 PostgreSQL, 1 second provider: "The path 'Nick.Value.Value' on Voucher goes past …"A_stored_flag_without_a_value_to_compare_with_is_refused: no exception was thrown{Rank.Value} = Closedfor{Rank.Value} = 1| After the review: every value through a member goes to the mapping |
A_value_the_translator_writes_is_written_through_a_member_as_beforealone:{Price.Value} = 5.0for= 5|| Any member named
Valueis looked through in a converter |A_structs_own_member_named_Value_is_not_looked_through_in_a_converteron the three providers: no "This converter is written otherwise" || The nullable's
Valueis a segment again (run again) | now also the sweep, with 125 rows that disagree,A_path_stored_with_the_nullables_value_in_it_is_the_same_objectandWhat_was_stored_wrongly_…|| A boolean member is no boolean column (run again) | now also
What_was_stored_wrongly_…|The conditions of
ModelFactsBindingTestsare one model, so a break that fails the binding fails its three tests together; the message says which condition.Run locally at the head of this branch,
main(11158ac) merged in:dotnet build CodoMetis.EFCore.SchemaKit.slnx: no warnings, no errors.mainat a130508 merged in), in a container of this session's own, started with the user's approval and removed after the run: the kernel's tests of categoryIntegration, 4 passed, the live parity sweep among them (Translated_predicates_and_expressions_answer_on_postgres_as_ef_cores_queries_do), which runs the ten new rows waived as "same"; and the PostgreSQL package's, 264 passed.mainwas merged in, and not run again: spike B withoutSPIKE_PG, every path as expected; spike D, every measured cell as its table says, 14 pairs of a consumer and a server not measured; spikes E and G all skipped, since each needs a server.Not run: anything on PostgreSQL 16 or on SQL Server, the consumer smoke test, and the live paths of spikes B, D, E and G. They are CI's lanes for this pull request.
Seen in the review and filed:
x.Place.HasValueandx.Place != nullon a complex property that can be null are refused, where EF Core writes"Place_City" IS NOT NULL(#279). The same onmain, and not part of this.For the review
🤖 Generated with Claude Code