https://github.com/lsantoss/lscode.notifications
Offers codes to facilitate creation and handling of inconsistency notifications in projects produced by LSCode.
https://github.com/lsantoss/lscode.notifications
csharp netstandard21 notifiable notification nuget-package
Last synced: about 2 months ago
JSON representation
Offers codes to facilitate creation and handling of inconsistency notifications in projects produced by LSCode.
- Host: GitHub
- URL: https://github.com/lsantoss/lscode.notifications
- Owner: lsantoss
- License: mit
- Created: 2023-02-20T16:50:34.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-22T22:12:02.000Z (about 2 years ago)
- Last Synced: 2024-04-27T08:21:45.253Z (about 1 year ago)
- Topics: csharp, netstandard21, notifiable, notification, nuget-package
- Language: C#
- Homepage:
- Size: 304 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LSCode.Notifications
[](https://www.nuget.org/packages/LSCode.Notifications)
## Application:
LSCode.Notifications is a library created to facilitate the management and handling of notifications of inconsistencies in projects.
It allows you to identify and consolidate failures or error messages in an organized way, useful for systems that require consistent and clear validations.
Type: Class Library.
## Framework:
- .Net 9
## Dependencies:
- N/A
## How to install:
- Click on the following link and see here some ways to install: [click here](https://www.nuget.org/packages/LSCode.Notifications "LSCode.Notifications page on nuget.org").
## How to use the Notification class:
In the file that you want to use the class, you must import the following namespace:
```c#
using LSCode.Notifications.Models;
```It is composed with 2 properties:
- Property
- Type: string
- Description: Validated property that has the inconsistency
- Message
- Type: string
- Description: Detailed description of the inconsistency foundThen you can create an instance of notification, passing by parameter:
- Property
- Message## How to use Notifiable class:
In the file that you want to use the class, you must import the following namespace:
```c#
using LSCode.Notifications.Models;
```Then it will be possible to inherit the notifiable class.
It is not possible to create an instance of the class, it is only possible to inherit it.
It is composed with 3 properties:
- Valid
- Type: boolean
- Description: Returns `true` if there are no notifications and `false` otherwise it happens
- Invalid
- Type: boolean
- Description: Returns `true` if there is at least one notification and `false` otherwise it happens
- Notifications
- Type: IReadOnlyCollection\
- Description: List containing all inconsistency notificationsThe values โโof these properties are modified only through the AddNotification() methods and ClearNotifications() method.
It is possible to add notifications through the **AddNotification()** method, which has 5 overloads:
```c#
void AddNotification(string property, string message);
void AddNotification(Notification notification);
void AddNotification(IEnumerable notifications);
void AddNotification(Notifiable notifiable);
void AddNotification(IEnumerable notifiableList);
```It is possible to clear the list of notifications and return to the initial state of all properties with the **ClearNotifications()** method:
```c#
void ClearNotifications();
```