-
Notifications
You must be signed in to change notification settings - Fork 0
added explanation for the setFullName Function #5
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
base: master
Are you sure you want to change the base?
Conversation
synchronizations/Synchronization.md
Outdated
} | ||
``` | ||
|
||
Next, we need to consider how the initialization should look. In our example, this will take place in the class constructor. |
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.
Should look like. What do you mean with "this"?
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.
The initialization
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.
ok. should look hört sich aber für mich eigenartig an, ich glaube should look like wäre besser
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.
okay
synchronizations/Synchronization.md
Outdated
familyRootModel.RootElements.Add(familyRegister); | ||
personRootModel.RootElements.Add(personRegister); | ||
|
||
repository.Models.Add(new Uri("ttc:source"), familyRootModel); |
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.
Using the Uris TTC:source and TTC:target is specific to the TTC. One could easily use other URIs
The synchronization rule, `FamilyRegisterToPersonRegister`, is specified from the `Families2PersonsSynchronization` class. | ||
It defines the logic for mapping data between the family register and the person register. | ||
Adding Registers: | ||
Both the family register and the person register are passed as parameters to the Synchronize method. |
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.
The idea is that you declare that these two model elements are corresponding to each other
familyRootModel.RootElements.Add(familyRegister); | ||
personRootModel.RootElements.Add(personRegister); | ||
|
||
repository.Models.Add(new Uri("ttc:source"), familyRootModel); |
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.
The reason for Models.Add is that the model is registered but there is no attempt of serializing to disk, because it is unclear where the model would be stored. If you work with actual models, they would typically have file Uris, loading and saving the models through their Uris
synchronizations/Synchronization.md
Outdated
} | ||
} | ||
``` | ||
This method named [SynchronizeMany](../synchronizations/api/NMF.Synchronizations.SynchronizationRuleBase.yml) facilitates bidirectional synchronization, implying that the method itself defines a dependency between both models. It synchronizes dependent elements using a synchronization rule, accepting a rule, left and right selectors in the model, and the types of dependent elements. Then, it initiates synchronization using the provided parameters. |
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.
It is actually a synchronization block, consisting of two lenses and a reference to a synchronization rule
synchronizations/Synchronization.md
Outdated
|
||
**Note:** | ||
|
||
At this point, it can be added that when synchronizing between a family and a person register that are already populated, the collision rule applies. For example, there is a man named Smith who marries a woman named Muster. As a result, the woman appears as Smith in the family register and as Muster in the person register. This leads to a collision, and the left side (family register) wins, so the woman's name in the person register is changed to Smith. |
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.
It can be added ist inhaltsleer, sollte entfernt werden. Wichtig ist aber, das passiert nur während der Initialen Synchronisation, nicht während der Updates
synchronizations/Synchronization.md
Outdated
[ObservableProxy(typeof(Helpers), "GetFullNameInc")] // connected with INotifyValue | ||
``` | ||
`ObservableProxy`: | ||
The annotations indicate that the `fullName` variable is constantly observed. This means that through the `GetFullNameInc` function with the parameter type `INotifyValue`, the `fullName` of the family member is continuously monitored. Upon any changes, the family member is notified, and the changes are propagated in real-time. |
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.
Vorsicht mit dem Begriff Realtime. Mit Echtzeit-Systemen haben wir wenig zu tun
synchronizations/Synchronization.md
Outdated
} | ||
} | ||
``` | ||
The `SetFullName` method is an extension method designed for objects implementing the `IFamilyMember` interface. When invoked, it first retrieves the associated family of the member. Assuming the full name is structured as "Last Name, First Name", it parses the `newName` parameter to extract the last and first names accordingly. Subsequently, it updates the member's Name property with the extracted first name. Additionally, if the associated family exists and its name differs from the extracted last name, it determines the member's gender based on familial relationships and adds the member to the family's collection, specifying the gender and the extracted last name. This method effectively manages the synchronization of the full name and family association of a family member. |
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.
Der wichtigste Punkt ist am dieser Stelle eigentlich, weil SetFullName als LensPut definiert ist, ist das quasi die Methode, um das Ergebnis von GetFullName zu überschreiben.
@@ -45,8 +45,8 @@ public Program() | |||
familyRootModel.RootElements.Add(familyRegister); | |||
personRootModel.RootElements.Add(personRegister); | |||
|
|||
repository.Models.Add(new Uri("ttc:source"), familyRootModel); | |||
repository.Models.Add(new Uri("ttc:target"), personRootModel); | |||
repository.Models.Add(new Uri("example/Uri"), familyRootModel); |
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.
Das ist keine valide URI. Eine URI muss immer ein : beinhalten.
No description provided.