Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Solution structure

The solution contains 2 3 projects:

  • NoahESSampleApp: Contains the sample app.

  • NoahESSamleApp.Server: ASP.NET Core webserver host of sample app.

  • NoahResource: Example of a Noah resource dll if app should be displayed in the Noah client module bar.

Sample App Project structure

  • Components: Contains Blazor UI Components. Notable is 'ActionCard.razor(.cs)', 'PatientCard.razor(.cs)' and 'PatientSessionsCard.razor(.cs)' that retrieves data and displays the information cards for a selected patient. Most of the components are made with a code-behind approach, where the view (.razor file) is separated from the logic in separate files (.razor.cs file).

  • Extensions: Contains a few helpful extension methods.

  • Mappers: Contains mappers to convert between data types.

  • Pages: Contains the pages that can be reached by an URL.

  • Services: Contains application services. A service is an abstraction level above the Noah Cloud API, that can contain validation or business logic and makes it easy to retrieve and store data. It is the services that are injected into the Blazor components. The project has following services:

    • IPatientService: Provides patient related CRUD operations.

    • IActionService: Provides action and session related CRUD operations.

    • IGlobalSettingsService: Provides read operations for global settings and data types.

    • IUserAccountService: Provides user account related CRUD operations.

    • IAppService: Provides app scope related CRUD operations.

    • IUserContext: Provides information about the authenticated user.

    • IETagService: Provides caching of ETags. The ETag (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag ) header is cached when the CallApi method is called in NoahCloudServiceBase.cs if an ObjectToETagCacheKeyConverter is registered for the returned object type. ObjectToETagCacheKeyConverter provides conversion from object to ETag cache keys, so an object of an object type which a ObjectToETagCacheKeyConverter is registered for, can be used to retrieve and store ETags. A list of ObjectToETagCacheKeyConverter is registered with the ETagService in Program.cs.

    • IAppStateService: Manages app state and makes necessary app connection operations. AppStateService has one method DetermineAppState which determines the current app state and makes app connections requests to:

      • Request initial app connection.

      • Request new permissions.

      • Determine if app has sufficient permissions to continue.

    • IRtmEventService: Provides operations to set up RTM event listening and publish the events to the event aggregator. SignalR (https://docs.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-6.0 ) is used to handle event subscription. A HubConnection is started in App. razor. RtmSetupComponent.razorstarts the HubConnection and contains logic to check the current app state and start listening for events using the IRtmService IRtmEventService. The RtmSetupComponent.razor component is created in MainLayout.razor. Also created in MainLayout.razor is the RtmEventHandlerComponent.razor component, which subscribes to RTM events and handles them. To subscribe to events call the hub method "SubscribeTenant" with the tenant id and event subscription id as arguments. There are 2 types of event subscriptionsdisplays them as a popup.
      There are 2 ways to subscribe to events:

      • App connection event subscription used when app is not connected with tenant. To subscribe invoke hub method "SubscribeTenant" with the tenant id and client id as arguments.

      • Noah event subscription used when app is connected with tenant. To subscribe invoke hub method "SubscribeTenant" with the tenant id and event subscription id as arguments. The app is responsible for creating an event subscription with the events it’s interested in.

    • IEventAggregator: The Event Aggregator acts as a single source of events for many objects. Used for easy messaging between components.

  • Shared: Contains the main layout of the app.

...