31 Create ModelViews (Country) (Wpf, Xamarin) - chempkovsky/CS2WPF-and-CS2XAMARIN GitHub Wiki
-
View (or ModelView) is the structure that the Web Api service sends to and receives from the client. For each entity, the developer must create at least one view.
-
To Add a View to the project
- Run Visual Studio and Open “ReactDmLit” solution
- Right Click “Literature” of the “Dm03Views”-project and select “ModelView Wizard” menu item to open the Wizard dialog
-
Note:
- On the first page of the dialog the destination folder is shown. The destination folder is the folder in which the generated file will be created.
- Click “Next”-button
- On the second page of the dialog the developer should select existing DbContext file.
- Select:
- Dm02Context (project)
- LitDbContext (context)
- Select:
- Click “Next”-button
- On the third page of the dialog the developer should select entity file.
- Select:
- Dm01Entity
- LitCountry
- Select:
- Click “Next”-button
- On the fourth page of the dialog the developer can select existing view for modification.
- Uncheck “Select View”
- Click “Next”-button
- On the fifth page select root node and check “Generate JsonProperty Attribute”.
- Two classes will be generated:
- “View” and “Page View”.
- The last one is used by pagination.
- Leave these names unchanged.
- On the fifth page check “Is Selected” for “Iso3”, “Iso2” and “CountryName” nodes. Leave “Property Name” and “Json Property Name” unchanged.
- Click “Next”
- On the sixth page select “ViewModel.cs.t4”
- click Next
- On the seventh page click “Save”.
- Open “C:\Development\WpfDemo” which is a root of the solution.
- New “.json” file has been created (or modified existing one). This is the repository of the wizards.
- Click “Next”
- On the eighth page select “ViewModelPage.cs.t4” and click Next.
- It generates the second class
- On the ninth page click save and close the dialog. The repository (.json) file has been updated again.
- Note #1:
- The repo file is updated only when you click the save button.
- Note #2:
- A separate repo file is created for each DBContext.