Skip to content

Commit

Permalink
Documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiffinlcd committed Jun 11, 2024
1 parent 634a907 commit 9846485
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 6 deletions.
50 changes: 50 additions & 0 deletions Docs/Blazor/Abstraction-Layer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Abstraction Layer
The abstraction layer is responsible for abstracting away the implementation of technology to services and external business processes that are consumed and used by the controller.

## Core Activities
This includes the following core activities.
- Technology specific implementation of services and business functionality presented to the controller.
- Transformation of data to and from application models from technology specific data models.
- Transformation of external exceptions into managed exceptions that can be raised to the controller.
- Event management for long running processes that use event notification when data is received.


# Load Behavior
The abstraction is loaded via dependency injection. Abstractions are always instance based and are registered as transient with dependency injection.

## Dependency Injection
Any external functionality that is needed on the abstraction is injected through constructor-based injection. The following items are generally injected into a controller.
- Logger
- Instances of Technology Specific Functionality


## Abstraction Initialization
Abstractions are initialized through the constructor of the abstraction class.
- Subscription to an event's from injected functionality.
- Passing in of configuration information to execute functionality.
- Custom logic that needs to be run when the abstract is loaded.


# Communications
The abstraction layer communicates with the controller layer.


### Abstraction to Controller Communications.
The abstraction at times will need to notify the controller of an event that has occurred or trigger and agreed upon action. This is accomplished by raising an event that is subscribed to by the controller.

```mermaid
flowchart LR;
A[Abstraction] -- Raise Event Handler --> C[Control]
```

# Event Management
The abstraction is responsible for handling any events that it has subscribed to. Generally, with an abstraction it will only subscribe to events on items consumed through dependency injection.

# Abstraction Disposal
The abstraction is expected to implement the **IDisposable** interface. The abstraction is responsible for the cleanup of its functionality. The following are common cleanup tasks for an abstraction.
- Unsubscribe to events.
- Call Dispose on injected functionality that support IDisposable.

[Back to PCA Pattern](/pcapattern.md)

2 changes: 1 addition & 1 deletion Docs/Control-Layer.md → Docs/Blazor/Control-Layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ The controller is expected to implement the **IDisposable** interface. The contr
- Unsubscribe to events.
- Call Dispose on injected functionality that support IDisposable.

[Back to PCA Pattern](/Docs/pcapattern.md)
[Back to PCA Pattern](/pcapattern.md)


Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ If data needs to be persisted beyond the life of a single usage of the presentat
# Event Management
The presentation is responsible for handling all events that are from html, java script, and components subscribed to on the presentation. There should be no direct subscription to presentation events from the controller.

[Back to PCA Pattern](/Docs/pcapattern.md)
[Back to PCA Pattern](/pcapattern.md)



9 changes: 9 additions & 0 deletions Docs/Blazor/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Presentation Control Abstraction for Server Side Blazor
This section provides the background of the **PCA** pattern implementation for server side Blazor. Later editions of this library will support mix mode and WASM based implementations of Blazor.


[PCA Pattern Overview](/pcapattern.md)

[Setup PCA Pattern in Server Side Blazor](/setup.md)

[Return to PCA Overview](../Readme.md)
48 changes: 48 additions & 0 deletions Docs/Blazor/Setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Setup PCA Pattern for Server Side Blazor
In this section we will outline how to setup a blazor server side project to use the PCA pattern.

## Configuring Program.cs
In the program.cs file we need to register two global services that are used for central management of notification and dialogs in the application.

Add the following statement before the builder creates the app. So basically before this line **var app = builder.Build();**
```
builder.Services.AddPCAServices();
```


## Setup Central Notification and Dialog Management
In the PCA framework there is support to host a central notifcation and dialog support. To do this you update your layout to host the components the execute the central management. Currently we have an example for telerik based components implemented.

Bellow is a code example of the components implemented in a layout. The components **TelerikCentralNotification** and **TelerikCentralDialog** are added just before the body definition is implemented.

```
@using CodeFactory.PCA.Blazor.Tel
@inherits LayoutComponentBase
<TelerikRootComponent>
<div class="page">
<div class="sidebar">
<NavMenu />
</div>
<main>
<div class="top-row px-4">
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
</div>
<TelerikCentralNotification HorizontalPosition="NotificationHorizontalPosition.Center" VerticalPosition="NotificationVerticalPosition.Bottom"/>
<TelerikCentralDialog/>
<article class="content px-4">
@Body
</article>
</main>
</div>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
</TelerikRootComponent>
```

[Return to Blazor Server for PCA](/Readme.md)
6 changes: 3 additions & 3 deletions Docs/pcapattern.md → Docs/Blazor/pcapattern.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ flowchart LR;
## Layer Definitions
The following will take you to the definition of each layer of the PCA pattern.

- [Presentation Layer](/Docs/Presentation-Layer.md)
- [Control Layer](/Docs/Control-Layer)
- [Abstraction Layer](/Docs/Abstraction-Layer)
- [Presentation Layer](/Presentation-Layer.md)
- [Control Layer](/Control-Layer.md)
- [Abstraction Layer](/Abstraction-Layer.md)
4 changes: 3 additions & 1 deletion Docs/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Overview
Placeholder for Documentation
The PCA pattern is defined on a per implementation basis. This section will link you to the documentation for guidance and implementation details.

[PCA for Blazor Server](/Blazor/Readme.md)

0 comments on commit 9846485

Please sign in to comment.