82 Web Api Service (Manuscript) (Wpf, Xamarin) - chempkovsky/CS2WPF-and-CS2XAMARIN GitHub Wiki

  • Before generating Web Api service the developer must define the set of View’s properties that

    • will be used for filtering
  • and the set of View’s properties that

    • will be used for sorting.
  • To Generate Web Api service

    • Run Visual Studio and Open “DmLit” solution
    • Right Click “Controllers”-folder of the “Dm04WebApp”-project and select “WebApiServices Wizard” menu item to open the Wizard dialog
  • Note:

    • 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 saved.

picture

- Click “Next”-button
- Click “Next”-button
  • On the second page of the dialog the developer should select existing DbContext file. Select:
    • Dm02Context (project)
    • LitDbContext (context)

picture

- Click “Next”-button
  • On the third page of the dialog the developer should select the View.
    • Select:
      • LitManuscriptView

picture

  • On the third page of the dialog the developer should define Properties for filtering and sorting. For our view, “Is used by filter” and “Is used by sorting” must be checked for all fileds (for demo purpose only):

picture

  • On the third page of the dialog the developer should define the Web Api methods to generate. For our view all methods is checked

picture

- Click “Next”
  • On the fourth page of the dialog the developer should select T4-script to generate Web Api Service. Only “DefaultWebApiService.cs.t4” must be selected for this purpose. Other scripts are used for the security

picture

- Click “Next”
  • On the fifth page of the dialog the developer should click “Save” and close the dialog.

picture

  • Note:
    • The Wizard’s repo file is updated only when you click “save” button
  • After generating very first Web Api service the developer must add references on Entity’s, Context’s and View’s projects.
    • In out case, we should add references on
      • Dm01Entity
      • Dm02Context
      • Dm03Views

picture