B0 Security: Authorization (Auxiliary C# Classes) (Wpf, Xamarin) - chempkovsky/CS2WPF-and-CS2XAMARIN GitHub Wiki

with "File explorer" open the folder of Visual Studio 2019 solution

picture

  • There three special files there:
    • Dm02Context.Dm02Context.csproj.Dm02Context.Literature.LitDbContext.json-file was created by the wizards for "LitDbContext"-DbContext
    • Dm02Context.Dm02Context.csproj.Dm02Context.AspNetBmSecurity.aspnetchckdbcontext.json-file was created by the wizards for "aspnetchckdbcontext"-DbContext
    • Dm02Context.Dm02Context.csproj.Dm02Context.Literature.LitDbContext.Feature.json-file was created by the Feature wizard for "LitDbContext"-DbContext

As it was described in 12.01 Auxiliary C# Classes and 14. Auxiliary classes. WHAT'S IN THE BOX articles we executed 00000-ContextLevelCommonInterfacesBatch.json for "LitDbContext"-DbContext.

  • Right click root folder of Dm04WebApp-project
    • Run JavaScripts wizard
    • on the second page select "LitDbContext"
    • on the third page select ==Context==
    • on the fourth page we have a big list of created action types

picture

  • By clicking "Back"-button go to the second page of the Wizard
    • on the second page select "aspnetchckdbcontext"
    • on the third page select ==Context==
    • on the fourth page we have an empty list of created action types !!!

picture

On the one hand, shared-classes has been already created and Dm02Context.Dm02Context.csproj.Dm02Context.Literature.LitDbContext.json-file holds the list of the created files. On the other hand, Dm02Context.Dm02Context.csproj.Dm02Context.AspNetBmSecurity.aspnetchckdbcontext.json-the file does not contain such information.

  • There are three possible solution
    • regenerate Auxiliary C# Classes for the "aspnetchckdbcontext"
      • not a very good way, as we will lose all changes to the generated files. For instance, MainWindowViewModel.cs.
    • use "import common staff"-button.
      • we should remember that batch operation will ignore imported data which is not persistent yet
      • so after import we should run any non batch operation and click save button
      • not a very good way,
    • with the text editor copy json-fragment from Dm02Context.Dm02Context.csproj.Dm02Context.Literature.LitDbContext.json-file to Dm02Context.Dm02Context.csproj.Dm02Context.AspNetBmSecurity.aspnetchckdbcontext.json-file
      • recommended approach

Text editor approach

  • with Visual Studio 2019
    • open first file: Dm02Context.Dm02Context.csproj.Dm02Context.Literature.LitDbContext.json
    • open second file: Dm02Context.Dm02Context.csproj.Dm02Context.AspNetBmSecurity.aspnetchckdbcontext.json
    • with context menu format each opened document

picture

  • in the window of Dm02Context.Dm02Context.csproj.Dm02Context.Literature.LitDbContext.json
    • collapse ModelViews- node and CommonStaffs- node

picture

  • in the window of Dm02Context.Dm02Context.csproj.Dm02Context.Literature.LitDbContext.json
    • select CommonStaffs- node

picture

  • in the window of Dm02Context.Dm02Context.csproj.Dm02Context.Literature.LitDbContext.json
    • with a context menu copy selection into the clipboard

picture

  • in the window of Dm02Context.Dm02Context.csproj.Dm02Context.AspNetBmSecurity.aspnetchckdbcontext.json
    • collapse ModelViews- node and CommonStaffs- node

picture

  • in the window of Dm02Context.Dm02Context.csproj.Dm02Context.AspNetBmSecurity.aspnetchckdbcontext.json
    • select "CommonStaffs": null
    • right click selection to open context menu
    • select "Paste"-command

picture

  • Save the file Dm02Context.Dm02Context.csproj.Dm02Context.AspNetBmSecurity.aspnetchckdbcontext.json

  • close both files: Dm02Context.Dm02Context.csproj.Dm02Context.AspNetBmSecurity.aspnetchckdbcontext.json and Dm02Context.Dm02Context.csproj.Dm02Context.Literature.LitDbContext.json

  • Right click src-folder

    • Run JavaScripts wizard
    • on the second page select "aspnetchckdbcontext"
    • on the third page select ==Context==
    • on the fourth page we have a big list of created action types

picture