A6 Security: Authorization (Entities and DBContext) (Wpf) - chempkovsky/CS2WPF-and-CS2XAMARIN GitHub Wiki

Creating Entities for Authorization

  • Step 1: Right click "AspNetMaskSecurity"-folder of Dm01Entity-project and select "Wpf form Wizard".
  • Step 2: On the first page (invitation page) click "next"-button.
  • Step 3: On the second page of the dialog the developer should select existing DbContext file.
    • Select:
      • Dm02Context (project)
      • LitDbContext (context)

picture

  • Step 4: On the third page, select "==Context==" and click "Next"-button

picture

  • Step 5: On the fourth page, click "patch processing"-button. "Batch action" dialog will be shown.

picture

  • Step 6: In "Batch action" dialog, select "00140-AspNetEntities.json"-script and click start-button. Make sure that "Errors"-panel is empty and close the Wizard.

Creating Developer Edition of DbContext for Authorization

  • Step 1: Right click "AspNetMaskSecurity"-folder of Dm02Context-project and select "Wpf form Wizard".
  • Repeat steps 2-5 of the Creating Entities for Authorization paragraph
  • Step 6: In "Batch action" dialog, select "00150-AspNetDbContextDev.json"-script and click start-button. Make sure that "Errors"-panel is empty and close the Wizard.

Note 1:

As a result you will obtain the following C# files

  • aspnetdashboard.cs
  • aspnetmodel.cs
  • aspnetrole.cs [dummy(mock) class]
  • aspnetrolemask.cs
  • aspnetuser.cs [dummy(mock) class]
  • aspnetusermask.cs [dummy(mock) class]
  • aspnetuserroles.cs [dummy(mock) class]

and one Db context C# file

  • aspnetchckdbcontext.cs [generated with aspnetdbcontext.cs.t4-script]

Note 2:

Except AspNetDbContextDev.json there is another script: AspNetDbContextProd.json. The last script must be executed right after defining generating ViewModels.

Note 3:

  • Some of the objects have been marked as dummy(mock) class. Here is a list.
    • 00400-aspnetrole.cs [dummy(mock) class]
    • 00410-aspnetuser.cs [dummy(mock) class]
    • 00420-aspnetuserroles.cs [dummy(mock) class]
    • 00430-aspnetusermask.cs [dummy(mock) class]

After generating ViewModels these four classes should be removed from the project.