029 Third View (Division) - chempkovsky/CS82ANGULAR GitHub Wiki

Definition

read the following article as reminder

Steps required to accomplish the task

Run ModelViews Wizard

repeat the steps described in the article

First page of the Wizard

repeat the steps described in the article

Second page of the Wizard

repeat the steps described in the article

Third page of the Wizard

  • On the third page of the Wizard we select Entity for the View. Choose PhBkEntity.csproj and PhbkDivision-class and click Next-button
Click to show the picture

project structure

Fourth page of the Wizard

repeat the steps described in the article

Fifth page of the Wizard

  • On the fifth page of the Wizard we define subset of properties, we turn on Jenerate JsonProperty Attribute-CheckBox, we Title and Plural Title for the given view.
Click to show the picture

project structure

  • On the fifth page of the Wizard click Foreign Keys / Enterprise: Divisions node in the tree
    • In the right panel select master View (in our case it is PhbkEnterpriseView)
Click to show the picture

project structure

  • On the fifth page of the Wizard click Foreign Keys / Enterprise: Divisions node in the tree
    • In the right panel replace EnterprisePhbkEnterpriseView with E in the Foreign Key Prefix-control
Click to show the picture

project structure

  • On the fifth page of the Wizard click Foreign Keys / Enterprise: Divisions node in the tree
    • expand Properties-sub node
    • uncheck EEntrprsId- property
    • uncheck EEntrprsDesc- property
Click to show the picture

project structure

  • click Next-button

Sixth page of the Wizard

repeat the steps described in the article

Seventh page of the Wizard

repeat the steps described in the article

The PhbkDivisionView.cs will be created in the PhBk-folder of the PhBkViews.csproj-project

Click to show the code
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Text.Json.Serialization;


namespace PhBkViews.PhBk {
    public class PhbkDivisionView {
        // [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 = "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!;

        // [JsonProperty(PropertyName = "divisionDesc")]
        [JsonPropertyName("divisionDesc")]
        [Display(Description="Description of the Enterprise Division",Name="Description of the Division",Prompt="Enter Enterprise Division Description",ShortName="Division Description")]
        [StringLength(250,ErrorMessage="Invalid")]
        public System.String ?  DivisionDesc { get; set; }

        // [JsonProperty(PropertyName = "entrprsIdRef")]
        [JsonPropertyName("entrprsIdRef")]
        [Required]
        [Display(Description="Row id",Name="Id of the Enterprise",Prompt="Enter Enterprise  Id",ShortName="Enterprise Id")]
        public System.Int32  EntrprsIdRef { get; set; }

        // [JsonProperty(PropertyName = "eEntrprsName")]
        [JsonPropertyName("eEntrprsName")]
        [Required]
        [Display(Description="Name of the Enterprise",Name="Name of the Enterprise",Prompt="Enter Enterprise Name",ShortName="Enterprise Name")]
        [StringLength(20,MinimumLength=3,ErrorMessage="Invalid")]
        public System.String  EEntrprsName { get; set; } = null!;

    }
}

Eighth page of the Wizard

repeat the steps described in the article

Ninth page of the Wizard

repeat the steps described in the article

The PhbkDivisionViewPage.cs will be created in the PhBk-folder of the PhBkViews.csproj-project

Click to show the code
//using System;
//using System.Collections.Generic;
//using System.ComponentModel.DataAnnotations;
//using System.Linq;
//using System.Linq.Expressions;
// using Newtonsoft.Json;
// using Newtonsoft.Json.Serialization;


namespace PhBkViews.PhBk {
    public class PhbkDivisionViewPage {
        public int page { get; set; }
        public int pagesize { get; set; }
        public int pagecount { get; set; }
        public int total { get; set; }
        public List<PhbkDivisionView> items { get; set; } = null!;
    }
}

Repo file

  • After Save-operation in the solution folder the Wizard's repo file will be created(or updated).
  • A separate repo file is created for each DbContext.
  • The repo file is updated only when you click the save button.
Click to show the picture

project structure

⚠️ **GitHub.com Fallback** ⚠️