404 First View (PhoneType). Wizard repository. - chempkovsky/CS82ANGULAR GitHub Wiki
- Run ModelViews Wizard
- First page of the Wizard
- Second page of the Wizard
- Third page of the Wizard
- Fourth page of the Wizard
- Fifth page of the Wizard
- Sixth page of the Wizard
- Seventh page of the Wizard
- Eighth page of the Wizard
- Ninth page of the Wizard
- View (or ModelView) is the structure that the WebApi service sends to and receives from the client. For each entity, the developer must create at least one view.
- View (or ModelView) is a Data Transfer Objects (DTO)
- For a given entity, the View (or ModelView) is a subset of the properties of the given entity and a subset of the properties of the direct and indirect master entities (in terms of the master-detail relationship).
- From the point of view of Sql constructions, for a given entity (table) View (or ModelView) is an sql View.
- To Add a View to the project
- Run Visual Studio and Open “rupbes.firstapp” solution
- Create
PhBk
-subfolder of therupbes.firstapp.Application.Contracts.csproj
-project - Right Click
PhBk
of therupbes.firstapp.Application.Contracts.csproj
-project and selectModelView 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
Click to show the picture
- On the second page of the Wizard we select DbContext that will be used to choose the entity for the View. Select
rupbes.firstapp.EntityFrameworkCore.csproj
and thefirstappDbContext
class using the drop-down lists. ClickNext
-button.
Click to show the picture
- On the third page of the Wizard we select Entity for the View. Choose
rupbes.firstapp.Domain.csproj
andPhbkPhoneType
-class and clickNext
-button
Click to show the picture
- On the fourth page of the Wizard we can select existing view to modify or import View-definition from another Repo. Since we have not any Views we just create
Next
-button.
Click to show the picture
- 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. ClickNext
-button. -
Note: We do not include
TenantId
in the dto class. Abp-repo class will do it for us.
Click to show the picture
- On the Sixth page of the Wizard we choose
AbpViewModel.cs.t4
T4-template to generate the code. ClickNext
-button.
Click to show the picture
- On the Seventh page of the Wizard click
Save
-button. ClickNext
-button.
Click to show the picture
The PhbkPhoneTypeDto.cs
will be created in the PhBk
-folder of the rupbes.firstapp.Application.Contracts.csproj
-project
Click to show the code
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
namespace rupbes.firstapp.PhBk {
public class PhbkPhoneTypeDto : EntityDto<System.Int32>, IHasConcurrencyStamp {
[JsonPropertyName("phoneTypeName")]
[Required]
[StringLength(20,MinimumLength=3,ErrorMessage="Invalid")]
[Display(Description="Name of the Phone Type",Name="Phone Type Name",Prompt="Enter Phone Type Name",ShortName="Phone Type Name")]
public System.String PhoneTypeName { get; set; } = null!;
[JsonPropertyName("phoneTypeDesc")]
[Display(Description="Description of the Phone Type",Name="Phone Type Description",Prompt="Enter Phone Type Description",ShortName="Phone Type Description")]
[StringLength(250,ErrorMessage="Invalid")]
public System.String ? PhoneTypeDesc { get; set; }
[JsonPropertyName("concurrencyStamp")]
[Required]
[Display(Description="Concurrency Stamp",Name="Concurrency Stamp",Prompt="Enter Concurrency Stamp",ShortName="Concurrency Stamp")]
[StringLength(40,MinimumLength=0,ErrorMessage="Invalid")]
public System.String ConcurrencyStamp { get; set; } = null!;
}
}
- On the Eighth page of the Wizard choose
AbpViewModelPage.cs.t4
-T4-template and clickNext
-button.
Click to show the picture
- On the Ninth page of the Wizard click
Save
-button and close the wizard.
Click to show the picture
The PhbkPhoneTypeDtoPage.cs
will be created in the PhBk
-folder of the rupbes.firstapp.Application.Contracts.csproj
-project
Click to show the code
using System.Collections.Generic;
namespace rupbes.firstapp.PhBk {
public class PhbkPhoneTypeDtoPage {
public int page { get; set; }
public int pagesize { get; set; }
public int pagecount { get; set; }
public int total { get; set; }
public List<PhbkPhoneTypeDto> items { get; set; } = null!;
}
}
- 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.