A5.02 Security: Server Side Authorization. Entities and DbContext. (Xamarin) - chempkovsky/CS2WPF-and-CS2XAMARIN GitHub Wiki

Two aspects

Security has two aspects: Authentication and Authorization

Notes

  • In the article A4.03 we mentioned permission storage.
    • Except that, we need the User interface for managing user data. To generate the Typescript classes we need the View-declarations.
      • Again, we can define Views only after declaring Entities and DBContext.
      • Thus, before creating views, we need a temporary explicit declaration of some entities defined by Microsoft IdentityDbContext. After generating the Views we must delete temporary entities.
      • Another aspect is permission storage entities. Some of permission storage entities must reference role-entity to persist (permission bitmask, role) pairs.
  • As a result, we need to generate Entities and DBContext twice.
    • first time, for modeling
    • second time, for production
  • In this article we will show how to generate Entities and DBContext for modeling.
    • Next time, after creating the code for the Views, we will regenerate the Entities and DBContext for production.

Steps required to accomplish the task

Entities

Run Wpf Forms Wizard for Entities

  • right click Auth-folder of the PhBkEntity.csproj-project
    • select Wpf Forms Wizard-menu item

First page for Entities

  • click Next-button on the first page

Second page for Entities

  • Select PhbkContext-project and PhbkDbContext-context and click Next-button
Click to show the picture

project structure

Third page for Entities

  • Select ==Context== and click Next-button
Click to show the picture

project structure

Fourth page for Entities

  • Click Batch processing-button
    • Batch Actions-dialog will be shown
Click to show the picture

project structure

Batch Actions Dialog for Entities

  • select 00040-AspNetEntitiesDev.json- batch script and click start
    • four files will be created
  • close dialog and close the Wizard
Click to show the picture

project structure

Dbcontext

Run Wpf Forms Wizard for Dbcontext

  • right click Auth-folder of the PhBkContext.csproj-project
    • select Wpf Forms Wizard-menu item

First page for Dbcontext

  • click Next-button on the first page

Second page for Dbcontext

  • Select PhbkContext-project and PhbkDbContext-context and click Next-button
Click to show the picture

project structure

Third page for Dbcontext

  • Select ==Context== and click Next-button
Click to show the picture

project structure

Fourth page for Dbcontext

  • Click Batch processing-button
    • Batch Actions-dialog will be shown
Click to show the picture

project structure

Batch Actions Dialog for Dbcontext

  • select 00050-AspNetDbContextDev.json- batch script and click start
    • four files will be created
  • close dialog and close the Wizard
Click to show the picture

project structure

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