From 273c96170f11438ef16226b8909ab5f56e1fb4dc Mon Sep 17 00:00:00 2001 From: Andres Pineda Date: Thu, 12 Dec 2024 23:19:34 -0500 Subject: [PATCH 1/3] docs: add missing KeyEquality to the menu --- doc/Learn/KeyEquality/toc.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 doc/Learn/KeyEquality/toc.yml diff --git a/doc/Learn/KeyEquality/toc.yml b/doc/Learn/KeyEquality/toc.yml new file mode 100644 index 0000000000..5f0519ac5b --- /dev/null +++ b/doc/Learn/KeyEquality/toc.yml @@ -0,0 +1,4 @@ +- name: Overview + href: xref:Uno.Extensions.KeyEquality.Concept +- name: Rules + href: xref:Uno.Extensions.Reactive.Rules From 0d10b5db3accf6737f9aa76a9bd71a1c1a4f3096 Mon Sep 17 00:00:00 2001 From: Andres Pineda Date: Thu, 12 Dec 2024 23:21:58 -0500 Subject: [PATCH 2/3] docs: fix keyequality document id --- doc/Learn/KeyEquality/rules.md | 2 +- doc/Learn/KeyEquality/toc.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/Learn/KeyEquality/rules.md b/doc/Learn/KeyEquality/rules.md index 851930fc68..f30e30254c 100644 --- a/doc/Learn/KeyEquality/rules.md +++ b/doc/Learn/KeyEquality/rules.md @@ -1,5 +1,5 @@ --- -uid: Uno.Extensions.Reactive.Rules +uid: Uno.Extensions.KeyEquality.Rules --- # Feeds code analyzers diff --git a/doc/Learn/KeyEquality/toc.yml b/doc/Learn/KeyEquality/toc.yml index 5f0519ac5b..2d6f4d7388 100644 --- a/doc/Learn/KeyEquality/toc.yml +++ b/doc/Learn/KeyEquality/toc.yml @@ -1,4 +1,4 @@ - name: Overview href: xref:Uno.Extensions.KeyEquality.Concept - name: Rules - href: xref:Uno.Extensions.Reactive.Rules + href: xref:Uno.Extensions.KeyEquality.Rules From 0981e15c09154f4ccd254de5f008fe5d028f4daa Mon Sep 17 00:00:00 2001 From: Andres Pineda Date: Thu, 12 Dec 2024 23:30:26 -0500 Subject: [PATCH 3/3] docs: improve KeyEquality rules documentation --- doc/Learn/KeyEquality/rules.md | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/doc/Learn/KeyEquality/rules.md b/doc/Learn/KeyEquality/rules.md index f30e30254c..ba117c4290 100644 --- a/doc/Learn/KeyEquality/rules.md +++ b/doc/Learn/KeyEquality/rules.md @@ -5,18 +5,18 @@ uid: Uno.Extensions.KeyEquality.Rules ## KE0001 -**A record eligible to IKeyEquatable generation must be partial.** +**A record eligible for IKeyEquatable generation must be partial.** You have a record that has a property that can be used to generate `IKeyEquatable` implementation for that record, but it was not declared as `partial`. -Add the `partial` modifier on your record, or disable the `IKeyEquatable` implementation generated using `[ImplicitKeyEquality(IsEnabled = false)]` on the record itself or on the whole assembly (not recommended). +Add the `partial` modifier on your record, or turn off the `IKeyEquatable` implementation generated using `[ImplicitKeyEquality(IsEnabled = false)]` on the record itself or the whole assembly (not recommended). ## KE0002 **A record that implements GetKeyHashCode should also implement KeyEquals.** -You have method named `GetKeyHashCode` in your record, but there is no `KeyEquals`. +You have a method named `GetKeyHashCode` in your record, but no `KeyEquals` exist. If you want to define a custom way to compute _key equality_, you have to implement both the `GetKeyHashCode` and `KeyEquals`. @@ -24,7 +24,7 @@ If you want to define a custom way to compute _key equality_, you have to implem **A record that implements KeyEquals should also implement GetKeyHashCode.** -You have method named `KeyEquals` in your record, but there is no `GetKeyHashCode`. +You have a method named `KeyEquals` in your record, but there is no `GetKeyHashCode`. If you want to define a custom way to compute _key equality_, you have to implement both the `GetKeyHashCode` and `KeyEquals`. @@ -32,22 +32,20 @@ If you want to define a custom way to compute _key equality_, you have to implem **A record flagged with `[ImplicitKeyEquality]` attribute must have an eligible key property** -You have a record that is flagged with `[ImplicitKeyEquality]` attribute, but there is no property that match any of the defined implicit keys. +You have a record flagged with the `[ImplicitKeyEquality]` attribute, but no property matches any of the defined implicit keys. -You should either remove the `[ImplicitKeyEquality]` attribute, either add a valid property name. +You should remove the `[ImplicitKeyEquality]` attribute or add a valid property name. ## KE0005 **A record should have only one matching key property for implicit IKeyEquatable generation.** -You have a record that is eligible for implicit key equality generation, but it has more than one matching implicit key. -The generated implementation of `IKeyEquatable` will use only the first key. +You have a record eligible for implicit key equality generation, but it has more than one matching implicit key. The generated implementation of `IKeyEquatable` will use only the first key. -You should either explicitly flag all needed key properties with the `[Key]` attribute, -either remove/rename properties that should not be used as key. +You should either explicitly flag all needed key properties with the `[Key]` attribute or remove/rename properties that should not be used as keys. > [!NOTE] -> By default the key equality generation will search for properties named `Id` or `Key`. +> By default, the key equality generation will search for `Id` or `Key` properties. > You can customize it using the `ImplicitKeyEquality` attribute. -> For instance setting `[assembly:ImplicitKeyEquality("Id", "MyCustomKey")]` on your assembly will no longer search for `Key` properties, +>, For instance, setting `[assembly:ImplicitKeyEquality("Id", "MyCustomKey")]` on your assembly will no longer search for `Key` properties, > but will instead search for `MyCustomKey` properties.