036 Creating Views for the Modeling Lookup Resource of PhbkDivision - chempkovsky/CS82ANGULAR GitHub Wiki
-
- Run ModelViews Wizard for LpdDivision
- First page of the Wizard for LpdDivision
- Second page of the Wizard for LpdDivision
- Third page of the Wizard for LpdDivision
- Fourth page of the Wizard for LpdDivision
- Fifth page of the Wizard for LpdDivision
- Sixth page of the Wizard for LpdDivision
- Seventh page of the Wizard for LpdDivision
- Eighth page of the Wizard for LpdDivision
- Ninth page of the Wizard for LpdDivision
-
- Run ModelViews Wizard for LprDivision01
- First page of the Wizard for LprDivision01
- Second page of the Wizard for LprDivision01
- Third page of the Wizard for LprDivision01
- Fourth page of the Wizard for LprDivision01
- Fifth page of the Wizard for LprDivision01
- Sixth page of the Wizard for LprDivision01
- Seventh page of the Wizard for LprDivision01
- Eighth page of the Wizard for LprDivision01
- Ninth page of the Wizard for LprDivision01
-
- Run ModelViews Wizard for LprDivision02
- First page of the Wizard for LprDivision02
- Second page of the Wizard for LprDivision02
- Third page of the Wizard for LprDivision02
- Fourth page of the Wizard for LprDivision02
- Fifth page of the Wizard for LprDivision02
- Sixth page of the Wizard for LprDivision02
- Seventh page of the Wizard for LprDivision02
- Eighth page of the Wizard for LprDivision02
- Ninth page of the Wizard for LprDivision02
read the following article as reminder
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 Add a View to the project
- Run Visual Studio and Open “PhonebookSolution” solution
- Right Click “PhBk” of the
LpPhBkViews
-project and select “ModelView Wizard” menu item to open the Wizard dialog-
Note:
LpPhBkViews
-project is used instead ofPhBkViews
-project
-
Note:
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
Click to show the picture
repeat the steps described in the article
- On the third page of the Wizard we select Entity for the View. Choose
PhBkEntity.csproj
andLpdDivision
-class and clickNext
-button
Click to show the picture
repeat the steps described in the article
- On the fifth page of the Wizard we define subset of properties, we turn on
Jenerate JsonProperty Attribute
-CheckBox, weTitle
andPlural Title
for the given view. - click
Next
-button
Click to show the picture
repeat the steps described in the article
repeat the steps described in the article
repeat the steps described in the article
repeat the steps described in the article
- The
LpdDivisionView.cs
andLpdDivisionViewPage.cs
will be created in thePhBk
-folder of theLpPhBkViews.csproj
-project. - Open each file and put all generated code inside
#if (!NOTMODELING) ... #endif
-operator
Click to show the code
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace PhBkViews.PhBk {
public class LpdDivisionView {
// [JsonProperty(PropertyName = "divisionNameId")]
[JsonPropertyName("divisionNameId")]
[Required]
[Display(Description="Row id",Name="Id of the Row",Prompt="Enter Row Id",ShortName="Row Id")]
public System.Int32 DivisionNameId { get; set; }
// [JsonProperty(PropertyName = "divisionName")]
[JsonPropertyName("divisionName")]
[Required]
[Display(Description="Name of the Enterprise Division",Name="Name of the Division",Prompt="Enter Division Name",ShortName="Division Name")]
[StringLength(20,MinimumLength=3,ErrorMessage="Invalid")]
public System.String DivisionName { get; set; } = null!;
}
}
- and
Click to show the code
namespace PhBkViews.PhBk {
public class LpdDivisionViewPage {
public int page { get; set; }
public int pagesize { get; set; }
public int pagecount { get; set; }
public int total { get; set; }
public List<LpdDivisionView> items { get; set; } = null!;
}
}
- repeat the steps describe in article: Run ModelViews Wizard for LpdDivision
- repeat the steps describe in article: First page of the Wizard for LpdDivision
repeat the steps described in the article
- On the third page of the Wizard we select Entity for the View. Choose
PhBkEntity.csproj
andLprDivision01
-class and clickNext
-button
Click to show the picture
repeat the steps described in the article
- On the fifth page of the Wizard we define subset of properties, we turn on
Jenerate JsonProperty Attribute
-CheckBox, weTitle
andPlural Title
for the given view.
Click to show the picture
- On the fifth page of the Wizard click
Foreign Keys / Division: DivisionRefs01
node in the tree- In the right panel select master View (in our case it is
PhbkDivisionView
)
- In the right panel select master View (in our case it is
Click to show the picture
- On the fifth page of the Wizard click
Foreign Keys / Division: DivisionRefs01
node in the tree- In the right panel replace
DivisionPhbkDivisionView
withD
in theForeign Key Prefix
-control
- In the right panel replace
Click to show the picture
- On the fifth page of the Wizard click
Foreign Keys / Division: DivisionRefs01
node in the tree- expand
Properties
-sub node - uncheck All properties
- expand
Click to show the picture
- On the fifth page of the Wizard click
Foreign Keys / DivisionNameDict: DivisionRefs01
node in the tree- In the right panel select master View (in our case it is
LpdDivisionView
)
- In the right panel select master View (in our case it is
Click to show the picture
- On the fifth page of the Wizard click
Foreign Keys / DivisionNameDict: DivisionRefs01
node in the tree- In the right panel replace
DivisionNameDictLpdDivisionView
withND
in theForeign Key Prefix
-control
- In the right panel replace
Click to show the picture
- On the fifth page of the Wizard click
Foreign Keys / DivisionNameDict: DivisionRefs01
node in the tree- expand
Properties
-sub node - uncheck All properties
- expand
Click to show the picture
- click
Next
-button
repeat the steps described in the article
repeat the steps described in the article
repeat the steps described in the article
repeat the steps described in the article
The LprDivision01View.cs
and LprDivision01ViewPage.cs
will be created in the PhBk
-folder of the LpPhBkViews.csproj
-project
Click to show the code
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace LpPhBkViews.PhBk {
public class LprDivision01View {
// [JsonProperty(PropertyName = "divisionId")]
[JsonPropertyName("divisionId")]
[Required]
[Display(Description="Row id",Name="Id of the Division",Prompt="Enter Division Id",ShortName="Division Id")]
public System.Int32 DivisionId { get; set; }
// [JsonProperty(PropertyName = "divisionNameIdRef")]
[JsonPropertyName("divisionNameIdRef")]
[Required]
[Display(Description="Row id",Name="Id of the Division",Prompt="Enter Division Id",ShortName="Division Id")]
public System.Int32 DivisionNameIdRef { get; set; }
}
}
- and
Click to show the code
namespace LpPhBkViews.PhBk {
public class LprDivision01ViewPage {
public int page { get; set; }
public int pagesize { get; set; }
public int pagecount { get; set; }
public int total { get; set; }
public List<LprDivision01View> items { get; set; } = null!;
}
}
- repeat the steps describe in article: Run ModelViews Wizard for LpdDivision
- repeat the steps describe in article: First page of the Wizard for LpdDivision
repeat the steps described in the article
- On the third page of the Wizard we select Entity for the View. Choose
PhBkEntity.csproj
andLprDivision02
-class and clickNext
-button
Click to show the picture
repeat the steps described in the article
- On the fifth page of the Wizard we define subset of properties, we turn on
Jenerate JsonProperty Attribute
-CheckBox, weTitle
andPlural Title
for the given view.
Click to show the picture
- On the fifth page of the Wizard click
Foreign Keys / Division: DivisionRefs02
node in the tree- In the right panel select master View (in our case it is
PhbkDivisionView
)
- In the right panel select master View (in our case it is
Click to show the picture
- On the fifth page of the Wizard click
Foreign Keys / Division: DivisionRefs02
node in the tree- In the right panel replace
DivisionPhbkDivisionView
withD
in theForeign Key Prefix
-control
- In the right panel replace
Click to show the picture
- On the fifth page of the Wizard click
Foreign Keys / Division: DivisionRefs02
node in the tree- expand
Properties
-sub node - uncheck All properties
- expand
Click to show the picture
- On the fifth page of the Wizard click
Foreign Keys / Enterprise: DivisionRefs02
node in the tree- In the right panel select master View (in our case it is
PhbkEnterpriseView
) - Make the setting as they shown below
- In the right panel select master View (in our case it is
Click to show the picture
- On the fifth page of the Wizard click
Foreign Keys / DivisionNameDict: DivisionRefs02
node in the tree- In the right panel select master View (in our case it is
LpdDivisionView
) - Make the setting as they shown below
- In the right panel select master View (in our case it is
Click to show the picture
- click
Next
-button
repeat the steps described in the article
repeat the steps described in the article
repeat the steps described in the article
repeat the steps described in the article
The LprDivision02View.cs
and LprDivision02ViewPage.cs
will be created in the PhBk
-folder of the LpPhBkViews.csproj
-project
At the end, 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