041 Web Api services for Lookup resource of PhbkDivisionView - chempkovsky/CS82ANGULAR GitHub Wiki
- Web Api Services for Modeling repo
- Web Api Services for production
- We need to generate each Web Api service twice. The first time is for modeling. (The
Wizard's repo
forPhbkDbContext
will be updated). The second time is for production. (TheWizard's repo
forLpPhbkDbContext
will be updated). We can not copy/paste from one repo to another. Entities declared forPhbkDbContext
-repo differ from those which are defined forLpPhbkDbContext
-repo. Some foreign keys for entities ofLpPhbkDbContext
-repo were removed.
- Before we start, open
Directory.Build.props
-file and modify it as follows:
<Project>
<PropertyGroup>
<DefineConstants>MODELING</DefineConstants>
</PropertyGroup>
</Project>
- save the
Directory.Build.props
-file - rebuild
PhBkContext
-project
- To Generate Web Api service
- Run Visual Studio and Open PhonebookSolution solution
- Right Click Controllers of the LpPhBkControllers-project and select WebApiServices Wizard menu item to open the Wizard dialog
Click to show the picture
- 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 Wizard we select DbContext that will be used to choose the entity for the View. Select PhBkContext.csproj and the PhBkContext class using the drop-down lists. Click Next
-button.
- On the third page of the Wizard
-
- select View
-
- choose the props to be used for sorting and filtering
-
- choose WebApi methods to generate
-
- if to
generate localized typescript code
-CheckBox usingAngular i18n
- if to
-
- Click
Next
-button
Click to show the picture
- On the Fourth page of the Wizard we choose
DefaultWebApiService.Core.cs.t4
T4-template to generate the code. ClickNext
-button.
- repeat the steps described in the article
The
LpdDivisionViewWebApiController.cs
will be created in the Controllers-folder of theLpPhBkControllers.csproj
-project
- repeat the steps described in the Web Api Services for modeling LpdDivision until third page
- On the third page of the Wizard
-
- select View
-
- choose the props to be used for sorting and filtering
-
- choose WebApi methods to generate
-
- if to
generate localized typescript code
-CheckBox usingAngular i18n
- if to
-
- Click
Next
-button
Click to show the picture
- On the Fourth page of the Wizard we choose
DefaultWebApiService.Core.cs.t4
T4-template to generate the code. ClickNext
-button.
- repeat the steps described in the article
The
LprDivision01ViewWebApiController.cs
will be created in the Controllers-folder of theLpPhBkControllers.csproj
-project
- repeat the steps described in the Web Api Services for modeling LpdDivision until third page
- On the third page of the Wizard
-
- select View
-
- choose the props to be used for sorting and filtering
-
- choose WebApi methods to generate
-
- if to
generate localized typescript code
-CheckBox usingAngular i18n
- if to
-
- Click
Next
-button
Click to show the picture
- On the Fourth page of the Wizard we choose
DefaultWebApiService.Core.cs.t4
T4-template to generate the code. ClickNext
-button.
- repeat the steps described in the article
The
LprDivision02ViewWebApiController.cs
will be created in the Controllers-folder of theLpPhBkControllers.csproj
-project
- Open
Directory.Build.props
-file and modify it as follows:
<Project>
<PropertyGroup>
<DefineConstants>NOTMODELING</DefineConstants>
</PropertyGroup>
</Project>
- save the
Directory.Build.props
-file - rebuild
PhBkContext
-project
- repeat the steps described in the Run WebApi Wizard for modeling LpdDivision
- repeat the steps described in the First page of the Wizard for modeling LpdDivision
On the second page of the Wizard we select DbContext that will be used to choose the entity for the View. Select LpPhBkContext.csproj
and the LpPhbkDbContext class using the drop-down lists. Click Next
-button.
- The View defined for the
PhbkDbContext
and the View defined for theLpPhBkContext
are identical- As a result, other pages of the Wizard will be the same as for modeling LpdDivision.
- repeat the steps described in the Web Api Services for LpdDivision until third page.
- starting the from third page repeat other steps described in the Web Api Services for modeling LprDivision01View .
- repeat the steps described in the Web Api Services for LpdDivision until third page.
- starting from the third page repeat other steps described in the Web Api Services for modeling LprDivision02View .