The 1000 steps program to MDriven Chapter 16

This is Chapter 16. If you want to go back to the beginning, you can find it here: Chapter 1.

Go back to Chapter 15: The_1000_steps_program_to_MDriven_Chapter_15

MDrivenEducationVideo Chapter 16: https://youtu.be/rmq7Hr3x0uU

Consider the lifecycle of the Car, it's created in the Factory and then sold - to a CarDealer.

We clean up the Main menu and move "New car" into new views for Carfactory.

493 Sort the main menu items into menu groups.

494 Delete one of the double PersonSeeker actions.

495 Make sure your servers run.

496 Check if there are changes when you upload the model.

497 Upload the model to make sure that the Turnkey server sees your menu changes.

498 Understand why CarSeeker requires a login - find the reference to the access group.

499 Understand the difference between having the access group on the action vs having it on the view - in the context of the discussion in the video regarding deep links.

500 Create a new car - and verify everything works. Get a registration number fairly quickly after saving.

501 Create a new CarFactorySeeker. Use the UI-first Copy Seeker autoform to get a suggestion really fast.

502 Clean up the columns you don't want in the Seeker result.

503 Add the Global action that shows the CarFactorySeeker to the Views menu group. The action was created by the "Copy Seeker auto form" UI first function.

504 Add a ViewModel-action NewCar and set its expression to CarFactory.Create

505 Follow the video and update the expression with a "let" construct to also give a name to the new factory.

506 Save and upload the model. Verify the CarFactorySeeker

507 Add a new Class-action ShowFactory - this action should bring a Document-form showing a specific factory.

508 Add a new CarFactory ViewModel. Set its class and set the checkbox - it requires a root.

509 Back to the action - set the ViewModel and set rootobject to self.

510 Back to the ViewModel - UI-First - Copy Document form.

511 Clean up the view to remove things we don't want by following the video.

512 Understand the different ways to remove ViewModel columns and widgets.

513 Check the actions on CarSeeker ViewModel. Delete the NewCar action from this view.

514 In the CarFactoryView, add a NewCar action.

515 In the Execute expression, create a new car. Use a let construct and set the CarOwner to the current factory.

516 Clean up the columns as in the video.

517 Save and upload the model.

518 Verify that the CarFactorySeeker brings up the CarFactoryView for the selected CarFactory.

519 Test the NewCar action and save. Verify that you get a new registration number.

520 A factory is tied to a specific brand - but our model does not yet reflect this fact.

521 In the main class diagram, create a new association between CarFactory and BrandOfCar. The CarFactory has 0..1 BrandOfCar and the BrandOfCar has 0 to many (0..*) CarFactories (there can be many BMW factories - but a BMW factory can only do one brand of cars - BMW).

522 Now, amend the NewCar action in the CarFactoryView to also assign the BrandOfCar for the created car to the value of BrandOfCar on the factory.

523 In the CarFactoryView, we also want to set what BrandOfCar this factory is producing. Add a combobox that lists all BrandOfCars and assigns to the CarFactory.BrandOfCar single association.

524 Save the model and go to the cloud dialog. Click the "changes" button. Now we should see that the db-schema must be updated to reflect the new foreign key in CarFactory to hold the BrandOfCar key.

525 Upload the model. Verify that the database has been evolved by "check server status".

526 In the CarFactory's list of cars, add the column to show the BrandOfCar.

527 In the video, I mistakenly delete the factory - this was due to the action "Delete this" being close to the "New Car", so I assumed that the delete was for the car - but it was for the factory. Give the "Delete this" action a better name like "Delete this factory".

528 Find the CarFactoryView's action ShowFactory and follow the discussion in the video on why this is worthless here - but necessary in other places - and do an opt-out in this position to clean the options up a bit.

529 Create a few (5) new cars - save with them getting unique registration numbers.

530 Since the factory Create cars, it will not actually purchase any cars, so we can remove the "DocumentForSales" grid and controls that belong to it from the view


File:AfterChapter16.zip Next chapter: The_1000_steps_program_to_MDriven_Chapter_17

This page was edited 19 days ago on 04/29/2024. What links here