Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

PE PRN221 - FA22 - TrialTest - Note

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

INSTRUCTIONS

Please read the instructions carefully before doing the questions.


 You are NOT allowed to use any other materials. You are NOT allowed to use any device to share data
with others.
 You must use Visual Studio 2019 or above, MSSQL Server 2008 or above for your development tools.

IMPORTANT – before you start doing your solution, MUST do the following steps:
1. To do your program, you must use ASP.NET Core Razor Pages. Note that you are not allow to connect
direct to database from Razor Pages, every database connection must be used with Repository and Data
Access Objects. The database connection string must get from appsettings.json file.
In the case your program connects directly to database from Razor Pages, you will get 0 mark.
1. Create Solution in Visual Studio named PRN221PE_FA22_TrialTest_StudentName. Inside the
Solution, Project ASP.NET Core Razor Page named: CandidateManagement_StudentName.
2. Create your MS SQL database named CandidateManagement by running code in script
CandidateManagement.sql.
3. Set the default user interface for your project as Login page.

Note
Install package using Tools  NuGet Package Manager  Package Manager Console
Install-Package Microsoft.EntityFrameworkCore.SqlServer -Version 5.0.17
Install-Package Microsoft.EntityFrameworkCore.Tools -Version 5.0.17
Install-Package Microsoft.EntityFrameworkCore.Design -Version 5.0.17

Install-Package Microsoft.Data.SqlClient -Version 3.0.1 (for ADO.NET option)

- Install package using CLI or Power Shell


dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 5.0.17
dotnet add package Microsoft.EntityFrameworkCore.Design --version 5.0.17
dotnet add package Microsoft.EntityFrameworkCore.Tools --version 5.0.17

dotnet add package Microsoft.Data.SqlClient --version 3.0.1 (for ADO.NET option)

- Connection String
"Server=(local);Uid=sa;Pwd=1234567890;Database=CandidateManagement"

Entity Framework Core


- Install dotnet-ef for CLI
dotnet tool install --global dotnet-ef --version 5.0.17

- Use Entity Framework Core to generate Object Model from existing database – CLI
dotnet ef dbcontext scaffold "Server=(local);Uid=sa;Pwd=1234567890;Database=CandidateManagement"
Microsoft.EntityFrameworkCore.SqlServer --output-dir Models

- Generate database from domain classes – CLI.


dotnet ef migrations add "InitialDB"
dotnet ef database update

Entity Framework Core


- Use Entity Framework Core to generate Object Model from existing database – Package Manager Console
Scaffold-DbContext "Server=(local);Database= CandidateManagement;Uid=sa;Pwd=1234567890;"
Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

- Generate database from domain classes – Package Manager Console


Add-Migration "InitialDB"
Update-Database -verbose

You might also like