Skip to content

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Cemtk6246
Copy link
Collaborator

No description provided.

}
```

Next, we need to consider how the initialization should look. In our example, this will take place in the class constructor.
Copy link
Contributor

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"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initialization

Copy link
Contributor

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

familyRootModel.RootElements.Add(familyRegister);
personRootModel.RootElements.Add(personRegister);

repository.Models.Add(new Uri("ttc:source"), familyRootModel);
Copy link
Contributor

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.
Copy link
Contributor

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);
Copy link
Contributor

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

}
}
```
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.
Copy link
Contributor

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


**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.
Copy link
Contributor

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

[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.
Copy link
Contributor

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

}
}
```
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.
Copy link
Contributor

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.

Nurhak Tuekek added 2 commits September 12, 2024 13:42
@@ -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);
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants