In this exercise you will learn how to use K2BEntityServices in GeneXus. K2BEntityServices is the main pattern in the K2BTools suite, and generates the base architecture upon which the application is built. Work With interfaces are built using this tool, as well as all interfaces needed to view, update or delete records for the transaction it is applied in.
- Open the “Country” transaction.
- Go to “Patterns” part.
|
Pattern Part |
- Select the option "Create with the default template".
|
Create with the default template. |
- Check the “Apply this pattern on save” option.
|
Apply Pattern On Save |
- Save the transaction.
Note: The first time a pattern is applied, a set of GeneXus objects, called “Basic Objects” are imported in the KB. This objects are referenced in the generated code, and implement common features. For this reason, the first time a pattern is applied the process takes longer.
- Go to the KB Explorer in GeneXus, and find the Country transaction. Now, this transaction should contain the instance as a child object, along with its generated objects.
|
Pattern-generated objects |
In this case, you will perform some changes to the default configuration.
- Open the "City" Transaction
- Apply the pattern to the City transaction following the same steps followed in the first step.
- WorkWith Node: Delete this node. After this deletion, cities will be accesible only through the Country Entity Manager.
|
Delete WorkWith |
- EntityManager Node: Delete the Customer SubWorkWith from this node.
|
Delete SubWorkWith |
After applying the pattern on this transaction, as seen in the first section, perform these changes.
- Delete all attributes except from "InvoiceCode", "InvoiceDate", "CustomerName", "CountryName" and "InvoiceTotal".
|
Invoice Attributes |
- Delete the “Payments” SubWorkWith from the EntityManager.
- Go to "Standard actions" node and set After Insert navigation property to "Return To Caller"
|
After Insert Property |
After applying the pattern on this transaction, as seen in the first section, perform these changes.
- Delete the WorkWith node.
- Delete all Components inside the Entity Manager, except the “General” component. You should delete all the SubWorkWith and Parallel nodes.
After applying the pattern on this transaction, as seen in the first section, perform these changes:
- Delete the WorkWith node.
Apply the pattern as seen in the first section.
Apply the pattern as seen in the first section.
Apply the pattern as seen in the first section.
Now that patterns are applied, run your application and see how our Entity Services Pattern works!
|